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

fix(config-api): lock endpoint fixes and SAML IDP NPE #9386

Merged
merged 59 commits into from
Sep 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
a3f3a66
fix(config-api): asset mgt endpoint fixes
pujavs Aug 5, 2024
9e309c0
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 5, 2024
59fd269
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
5a6396a
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
521f7b1
feat(config-api): asset upload mgt ehancement and fido
pujavs Aug 6, 2024
73618dd
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 6, 2024
583c881
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 7, 2024
95c57e4
fix(config-api): asset upload
pujavs Aug 8, 2024
ca50ec7
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 8, 2024
bbcbc92
fix(config-api): lock review comments
pujavs Aug 8, 2024
2bb92e3
feat(config-api): lock code review comments
pujavs Aug 9, 2024
c900d5f
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
eb62da4
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
6fad621
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
d17d2e6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 9, 2024
7fefadb
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
cf85c47
feat(config-api): lock master renamed to lock server
pujavs Aug 9, 2024
c0444b5
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 11, 2024
ccf9ace
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
2d4a379
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
dd6555c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 12, 2024
4696f98
feat(config-api): fido2 delete functionality
pujavs Aug 13, 2024
3b51e0d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 13, 2024
5af8a00
fix(config-api): acr validation
pujavs Aug 14, 2024
88e3a20
feat(config-api): doc(config-api): IDP schema attribute descriptions …
pujavs Aug 15, 2024
cadc584
feat(config-api): sync with main
pujavs Aug 15, 2024
c4eb118
feat(config-api): sync with main
pujavs Aug 15, 2024
4de3cc0
feat(config-api): uploading assets via API generates 2 entries #9178
pujavs Aug 15, 2024
dfbc4f1
feat(config-api): asset mgt, fido and IDP changes
pujavs Aug 16, 2024
c3ba202
feat(config-api): fido2 device endpoint
pujavs Aug 19, 2024
34d1c9a
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 20, 2024
4473a90
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
6d974ed
feat(config-api): fido2 endpoint
pujavs Aug 20, 2024
5272c28
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 21, 2024
c6f2234
feat(config-api): sync with main
pujavs Aug 21, 2024
cbc8164
feat(config-api): sync with main
pujavs Aug 21, 2024
8e45ae3
feat(config-api): sync with main
pujavs Aug 21, 2024
d2c8277
feat(config-api): resolved sonar review issues
pujavs Aug 21, 2024
792c81c
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 22, 2024
9dfba84
feat(config-api): sonar review comment fix
pujavs Aug 22, 2024
54b2f59
feat(config-api): swagger spec
pujavs Aug 22, 2024
8d92097
feat(config-api): swagger spec
pujavs Aug 22, 2024
e078be2
feat(config-api): saml config attribute description
pujavs Aug 22, 2024
b7eac33
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
1fd93d8
doc(config-api): added SAML attribute description
pujavs Aug 23, 2024
28fed18
feat(config-api): sync with main
pujavs Aug 26, 2024
0d05fb6
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 27, 2024
573e47e
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Aug 30, 2024
4590a55
feat(config-api): sync with main
pujavs Aug 30, 2024
cd764d6
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
d4e4c41
fix(jans-lock): code review comment fix isssue#9305
pujavs Aug 30, 2024
07ca449
feat(config-api): lock review point
pujavs Sep 2, 2024
2e98591
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 3, 2024
a513d11
fix(lock): code review comment
pujavs Sep 3, 2024
7e86521
fix(lock): code review comment
pujavs Sep 3, 2024
db7f37d
Merge branch 'main' of https://github.com/JanssenProject/jans into ja…
pujavs Sep 4, 2024
f1c1c29
fix(config-api): sync with main
pujavs Sep 4, 2024
77c5d46
feat(config-api): lock endpoint fixes and SAML IDP NPE
pujavs Sep 5, 2024
a85bdca
Merge branch 'main' into jans-config-fix
yuriyz Sep 5, 2024
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
Prev Previous commit
Next Next commit
fix(lock): code review comment
Signed-off-by: pujavs <pujas.works@gmail.com>
  • Loading branch information
pujavs committed Sep 3, 2024
commit 7e865214112131c9bf4911152ce2aa19aa69e6ac
16 changes: 8 additions & 8 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
@@ -8370,15 +8370,15 @@ components:
type: boolean
adminCanEdit:
type: boolean
adminCanAccess:
type: boolean
adminCanView:
type: boolean
userCanAccess:
userCanEdit:
type: boolean
userCanView:
type: boolean
userCanEdit:
adminCanAccess:
type: boolean
userCanAccess:
type: boolean
whitePagesCanView:
type: boolean
@@ -9226,8 +9226,6 @@ components:
type: boolean
lockMessageConfig:
$ref: '#/components/schemas/LockMessageConfig'
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
@@ -9237,6 +9235,8 @@ components:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
required:
- baseDn
@@ -10805,10 +10805,10 @@ components:
ttl:
type: integer
format: int32
persisted:
type: boolean
opbrowserState:
type: string
persisted:
type: boolean
SessionIdAccessMap:
type: object
properties:
3 changes: 3 additions & 0 deletions jans-config-api/plugins/docs/lock-plugin-swagger.yaml
Original file line number Diff line number Diff line change
@@ -357,6 +357,9 @@ components:
tokenUrl:
type: string
description: Jans URL of the OpenID Connect Provider's OAuth 2.0 Token Endpoint
groupScopeEnabled:
type: boolean
description: Group scope enabled
endpointGroups:
type: object
additionalProperties:
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ public class TelemetryEntry extends BaseEntry implements Serializable {
@AttributeName(name = "jansSuccessLoadCounter")
private long policySuccessLoadCounter;

@AttributeName(name = "jansFaiedlLoadCounter")
@AttributeName(name = "jansFailedLoadCounter")
private long policyFailedLoadCounter;

@AttributeName(name = "evaluationTimeNs")
Original file line number Diff line number Diff line change
@@ -206,50 +206,40 @@ private boolean externalAuthorization(String token, String issuer, String method
}

private List<String> findMissingScopes(Map<ProtectionScopeType, List<String>> scopeMap, List<String> tokenScopes) {
logger.debug("Check scopeMap:{}, tokenScopes:{}", scopeMap, tokenScopes);
logger.error("\n\n\n *** Check scopeMap:{}, tokenScopes:{}", scopeMap, tokenScopes);

List<String> scopeList = new ArrayList<>();
if (tokenScopes == null || tokenScopes.isEmpty() || scopeMap == null || scopeMap.isEmpty()) {
List<String> missingScopes = null;
if (scopeMap == null || scopeMap.isEmpty()) {
return scopeList;
}

// Super scope
scopeList = scopeMap.get(ProtectionScopeType.SUPER);
scopeList.addAll(scopeMap.get(ProtectionScopeType.SUPER));
logger.debug("SUPER Scopes:{}", scopeList);
List<String> missingScopes = null;
boolean containsScope = false;
if (scopeList != null && !scopeList.isEmpty()) {
// check if token contains any of the super scopes
containsScope = containsAnyElement(scopeList, tokenScopes);
logger.debug("Token contains SUPER scopes?:{}", containsScope);

// Super scope present so no need to check other types of scope
if (containsScope) {
return missingScopes;
}
}



// Group scope present so no need to check normal scope presence
scopeList = scopeMap.get(ProtectionScopeType.GROUP);
scopeList.addAll(scopeMap.get(ProtectionScopeType.GROUP));
logger.debug("GROUP Scopes:{}", scopeList);
if (scopeList != null && !scopeList.isEmpty()) {
// check if token contains any of the group scopes
containsScope = containsAnyElement(scopeList, tokenScopes);
logger.debug("Token contains GROUP scopes?:{}", containsScope);

// Group scope present so no need to check normal scope
if (containsScope) {
return missingScopes;
}
}


// Normal scope
scopeList = scopeMap.get(ProtectionScopeType.SCOPE);
scopeList.addAll(scopeMap.get(ProtectionScopeType.SCOPE));
logger.debug("SCOPE Scopes:{}", scopeList);
if (scopeList != null && !scopeList.isEmpty()) {
// check if token contains all the required scopes
missingScopes = findMissingElements(scopeList, tokenScopes);
logger.debug("SCOPE Missing Scopes:{}", missingScopes);
if(scopeList.isEmpty()) {
return missingScopes;
}

//scopeList not empty but token scope is null
if(tokenScopes==null || tokenScopes.isEmpty()) {
return scopeMap.get(ProtectionScopeType.SCOPE);
}

// check if token contains all the required scopes
missingScopes = findMissingElements(scopeList, tokenScopes);
logger.debug("SCOPE Missing Scopes:{}", missingScopes);

return missingScopes;
}

6 changes: 3 additions & 3 deletions jans-linux-setup/jans_setup/schema/jans_schema.json
Original file line number Diff line number Diff line change
@@ -3936,10 +3936,10 @@
"x_origin": "Jans created attribute"
},
{
"desc": "jansFaiedlLoadCounter",
"desc": "jansFailedLoadCounter",
"equality": "integerMatch",
"names": [
"jansFaiedlLoadCounter"
"jansFailedLoadCounter"
],
"oid": "jansAttr",
"syntax": "1.3.6.1.4.1.1466.115.121.1.27",
@@ -5489,7 +5489,7 @@
"jansStatus",
"jansDownloadSize",
"jansSuccessLoadCounter",
"jansFaiedlLoadCounter",
"jansFailedLoadCounter",
"evaluationTimeNs",
"averageTimeNs",
"memoryUsage",
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
"clientId": "%(lock_client_id)s",
"clientPassword": "%(lock_client_encoded_pw)s",
"tokenUrl": "%(tokenEndpoint)s",
"groupScopeEnabled": true,
"endpointGroups": {
"audit": [
"telemetry",
Original file line number Diff line number Diff line change
@@ -62,6 +62,10 @@ 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")
@@ -186,6 +190,14 @@ public String getTokenUrl() {
public void setTokenUrl(String tokenUrl) {
this.tokenUrl = tokenUrl;
}

public Boolean getGroupScopeEnabled() {
return groupScopeEnabled;
}

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

public Map<String, List<String>> getEndpointGroups() {
return endpointGroups;
@@ -327,7 +339,7 @@ public void setPoliciesZipUris(List<String> policiesZipUris) {
public String toString() {
return "AppConfiguration [baseDN=" + baseDN + ", baseEndpoint=" + baseEndpoint + ", openIdIssuer="
+ openIdIssuer + ", tokenChannels=" + tokenChannels + ", clientId=" + clientId + ", tokenUrl="
+ tokenUrl + ", endpointGroups=" + endpointGroups + ", endpointDetails=" + endpointDetails
+ tokenUrl + ", groupScopeEnabled=" + groupScopeEnabled+ ", endpointGroups=" + endpointGroups + ", endpointDetails=" + endpointDetails
+ ", disableJdkLogger=" + disableJdkLogger + ", loggingLevel=" + loggingLevel + ", loggingLayout="
+ loggingLayout + ", externalLoggerConfiguration=" + externalLoggerConfiguration + ", metricChannel="
+ metricChannel + ", metricReporterInterval=" + metricReporterInterval + ", metricReporterKeepDataDays="
Original file line number Diff line number Diff line change
@@ -109,6 +109,7 @@ public Token getToken(String tokenUrl, String clientId, String clientSecret, Str
if (tokenResponse != null) {
final String accessToken = tokenResponse.getAccessToken();
final Integer expiresIn = tokenResponse.getExpiresIn();
log.error("accessToken:{}, expiresIn:{}", accessToken, expiresIn);
if (Util.allNotBlank(accessToken)) {
return new Token(null, null, accessToken, ScopeType.OPENID.getValue(), expiresIn);
}
@@ -380,7 +381,7 @@ public Response post(String endpoint, String postData, ContentType contentType,
log.error("postData - endpoint:{}, postData:{}", endpoint, postData);
String endpointPath = this.getEndpointPath(endpoint);

log.error("Posting data for - endpoint:{}, endpointPath:{}", endpoint, endpointPath);
log.error("Posting data for - endpoint:{}, endpointPath:{},this.getEndpointUrl(endpointPath):{}", endpoint, endpointPath,this.getEndpointUrl(endpointPath));
return post(this.getEndpointUrl(endpointPath), null, token, null, contentType, postData);
}