Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lock docs #10700

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"clientId": "%(lock_client_id)s",
"clientPassword": "%(lock_client_encoded_pw)s",
"tokenUrl": "%(jans_auth_token_endpoint)s",
"groupScopeEnabled": true,
"endpointGroups": {
"audit": [
"telemetry",
Expand Down Expand Up @@ -52,14 +51,11 @@
"metricReporterKeepDataDays": 15,
"metricReporterEnabled": true,
"statEnabled": true,
"errorReasonEnabled": false,
"opaConfiguration": {
"baseUrl": "http://%(jans_opa_host)s:%(jans_opa_port)s/v1/",
"accessToken": ""
},
"policiesJsonUris": [],
"policiesJsonUrisAuthorizationToken": "",
"policiesZipUris": [],
"policiesZipUrisAuthorizationToken": "",
"pdpType": "OPA"
"messageConsumerType" : "DISABLED",
"policyConsumerType" : "DISABLED",
"errorReasonEnabled": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.jans.lock.model.config;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -70,10 +69,6 @@ public class AppConfiguration implements Configuration {
@DocProperty(description = "Jans URL of the OpenID Connect Provider's OAuth 2.0 Token Endpoint")
@Schema(description = "Jans URL of the OpenID Connect Provider's OAuth 2.0 Token Endpoint")
private String tokenUrl;

@DocProperty(description = "Group scope enabled")
@Schema(description = "Group scope enabled")
private boolean groupScopeEnabled;

@DocProperty(description = "Endpoint groups")
@Schema(description = "Endpoint groups")
Expand All @@ -99,10 +94,6 @@ public class AppConfiguration implements Configuration {
@Schema(description = "The path to the external log4j2 logging configuration")
private String externalLoggerConfiguration;

@DocProperty(description = "Channel for metric reports", defaultValue = "jans_pdp_metric")
@Schema(description = "Channel for metric reports")
private String metricChannel;

@DocProperty(description = "The interval for metric reporter in seconds")
@Schema(description = "The interval for metric reporter in seconds")
private int metricReporterInterval;
Expand All @@ -120,13 +111,6 @@ public class AppConfiguration implements Configuration {
@Schema(description = "Time interval for the Clean Service in seconds")
private int cleanServiceInterval;

@Schema(description = "Opa Configuration")
private OpaConfiguration opaConfiguration;

@DocProperty(description = "PDP type")
@Schema(description = "PDP type")
private String pdpType;

@DocProperty(description = "Authorization token to access Json Uris")
@Schema(description = "Authorization token to access Json Uris")
private String policiesJsonUrisAuthorizationToken;
Expand All @@ -143,6 +127,14 @@ public class AppConfiguration implements Configuration {
@Schema(description = "List of Zip Uris with policies")
private List<String> policiesZipUris;

@DocProperty(description = "PubSub consumer service")
@Schema(description = "PubSub consumer service")
private String messageConsumerType;

@DocProperty(description = "Policy consumer service")
@Schema(description = "Policy consumer service")
private String policyConsumerType;

@DocProperty(description = "Boolean value specifying whether to return detailed reason of the error from AS. Default value is false", defaultValue = "false")
private Boolean errorReasonEnabled = false;

Expand Down Expand Up @@ -217,14 +209,6 @@ public String getTokenUrl() {
public void setTokenUrl(String tokenUrl) {
this.tokenUrl = tokenUrl;
}

public boolean isGroupScopeEnabled() {
return groupScopeEnabled;
}

public void setGroupScopeEnabled(boolean groupScopeEnabled) {
this.groupScopeEnabled = groupScopeEnabled;
}

public Map<String, List<String>> getEndpointGroups() {
return endpointGroups;
Expand Down Expand Up @@ -274,14 +258,6 @@ public void setExternalLoggerConfiguration(String externalLoggerConfiguration) {
this.externalLoggerConfiguration = externalLoggerConfiguration;
}

public String getMetricChannel() {
return metricChannel;
}

public void setMetricChannel(String metricChannel) {
this.metricChannel = metricChannel;
}

public int getMetricReporterInterval() {
return metricReporterInterval;
}
Expand Down Expand Up @@ -314,22 +290,6 @@ public void setCleanServiceInterval(int cleanServiceInterval) {
this.cleanServiceInterval = cleanServiceInterval;
}

public OpaConfiguration getOpaConfiguration() {
return opaConfiguration;
}

public void setOpaConfiguration(OpaConfiguration opaConfiguration) {
this.opaConfiguration = opaConfiguration;
}

public String getPdpType() {
return pdpType;
}

public void setPdpType(String pdpType) {
this.pdpType = pdpType;
}

public String getPoliciesJsonUrisAuthorizationToken() {
return policiesJsonUrisAuthorizationToken;
}
Expand Down Expand Up @@ -362,7 +322,25 @@ public void setPoliciesZipUris(List<String> policiesZipUris) {
this.policiesZipUris = policiesZipUris;
}

public Boolean getErrorReasonEnabled() {
public String getMessageConsumerType() {
if (messageConsumerType == null) messageConsumerType = "DISABLED";
return messageConsumerType;
}

public void setMessageConsumerType(String messageConsumerType) {
this.messageConsumerType = messageConsumerType;
}

public String getPolicyConsumerType() {
if (policyConsumerType == null) policyConsumerType = "DISABLED";
return policyConsumerType;
}

public void setPolicyConsumerType(String policyConsumerType) {
this.policyConsumerType = policyConsumerType;
}

public Boolean getErrorReasonEnabled() {
if (errorReasonEnabled == null) errorReasonEnabled = false;
return errorReasonEnabled;
}
Expand All @@ -376,17 +354,16 @@ public String toString() {
return "AppConfiguration [baseDN=" + baseDN + ", baseEndpoint=" + baseEndpoint + ", openIdIssuer="
+ openIdIssuer + ", statEnabled=" + statEnabled + ", statTimerIntervalInSeconds="
+ statTimerIntervalInSeconds + ", tokenChannels=" + tokenChannels + ", clientId=" + clientId
+ ", clientPassword=" + clientPassword + ", tokenUrl=" + tokenUrl + ", groupScopeEnabled="
+ groupScopeEnabled + ", endpointGroups=" + endpointGroups + ", endpointDetails=" + endpointDetails
+ ", disableJdkLogger=" + disableJdkLogger + ", loggingLevel=" + loggingLevel + ", loggingLayout="
+ loggingLayout + ", externalLoggerConfiguration=" + externalLoggerConfiguration + ", metricChannel="
+ metricChannel + ", metricReporterInterval=" + metricReporterInterval + ", metricReporterKeepDataDays="
+ metricReporterKeepDataDays + ", metricReporterEnabled=" + metricReporterEnabled
+ ", cleanServiceInterval=" + cleanServiceInterval + ", opaConfiguration=" + opaConfiguration
+ ", pdpType=" + pdpType + ", policiesJsonUrisAuthorizationToken=" + policiesJsonUrisAuthorizationToken
+ ", policiesJsonUris=" + policiesJsonUris + ", policiesZipUrisAuthorizationToken="
+ policiesZipUrisAuthorizationToken + ", policiesZipUris=" + policiesZipUris + ", errorReasonEnabled="
+ errorReasonEnabled + "]";
+ ", clientPassword=" + clientPassword + ", tokenUrl=" + tokenUrl + ", endpointGroups=" + endpointGroups
+ ", endpointDetails=" + endpointDetails + ", disableJdkLogger=" + disableJdkLogger + ", loggingLevel="
+ loggingLevel + ", loggingLayout=" + loggingLayout + ", externalLoggerConfiguration="
+ externalLoggerConfiguration + ", metricReporterInterval=" + metricReporterInterval
+ ", metricReporterKeepDataDays=" + metricReporterKeepDataDays + ", metricReporterEnabled="
+ metricReporterEnabled + ", cleanServiceInterval=" + cleanServiceInterval
+ ", policiesJsonUrisAuthorizationToken=" + policiesJsonUrisAuthorizationToken + ", policiesJsonUris="
+ policiesJsonUris + ", policiesZipUrisAuthorizationToken=" + policiesZipUrisAuthorizationToken
+ ", policiesZipUris=" + policiesZipUris + ", messageConsumerType=" + messageConsumerType
+ ", policyConsumerType=" + policyConsumerType + ", errorReasonEnabled=" + errorReasonEnabled + "]";
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.jans.lock.service;

import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
Expand All @@ -9,7 +8,6 @@
import java.util.Set;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.http.HttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.util.EntityUtils;
Expand Down Expand Up @@ -263,15 +261,12 @@ private String getEndpointUrl(String endpoint) {
}

private String getScopeForToken(String endpoint, boolean allGroupScopes) {
log.info("Request for token for endpoint:{}, allGroupScopes:{}, appConfiguration.isGroupScopeEnabled():{}",
endpoint, allGroupScopes, appConfiguration.isGroupScopeEnabled());
log.info("Request for token for endpoint:{}, allGroupScopes:{}", endpoint, allGroupScopes);
StringBuilder sb = new StringBuilder();
sb.append(ScopeType.OPENID.getValue());
List<String> scopeList = null;

boolean groupScopeEnabled = this.appConfiguration.isGroupScopeEnabled();

if (allGroupScopes && groupScopeEnabled) {
if (allGroupScopes) {
scopeList = this.getAllGroupScope(endpoint);
} else {
scopeList = this.getScopes(endpoint);
Expand Down Expand Up @@ -389,19 +384,4 @@ private Response post(String url, String authType, String token, Map<String, Str
return response;
}

public boolean isTokenValid(Date expiryDate) {
if (expiryDate == null) {
return false;
}
return expiryDate.after(new Date());
}

public Date computeTokenExpiryTime(Integer expiresIn) {
log.debug("expiresIn:{}", expiresIn);
Date currDate = new Date();
Date expiryDate = DateUtils.addSeconds(currDate, expiresIn);
log.debug("currDate:{}, expiresIn:{}, expiryDate:{}", currDate, expiresIn, expiryDate);
return expiryDate;
}

}
Loading
Loading