Skip to content

Commit

Permalink
fix(oxauth): backported introspectionRestrictBasicAuthnToOwnTokens to…
Browse files Browse the repository at this point in the history
… 4.5.3.sp1
  • Loading branch information
yuriyz committed Aug 7, 2024
1 parent e400195 commit 38b840c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ public class AppConfiguration implements Configuration {

private Boolean introspectionAccessTokenMustHaveUmaProtectionScope = false;
private Boolean introspectionSkipAuthorization;
private Boolean introspectionRestrictBasicAuthnToOwnTokens = false;

private Boolean endSessionWithAccessToken;
private String cookieDomain;
Expand Down Expand Up @@ -584,6 +585,15 @@ public void setIntrospectionSkipAuthorization(Boolean introspectionSkipAuthoriza
this.introspectionSkipAuthorization = introspectionSkipAuthorization;
}

public Boolean getIntrospectionRestrictBasicAuthnToOwnTokens() {
if (introspectionRestrictBasicAuthnToOwnTokens == null) introspectionRestrictBasicAuthnToOwnTokens = false;
return introspectionRestrictBasicAuthnToOwnTokens;
}

public void setIntrospectionRestrictBasicAuthnToOwnTokens(Boolean introspectionRestrictBasicAuthnToOwnTokens) {
this.introspectionRestrictBasicAuthnToOwnTokens = introspectionRestrictBasicAuthnToOwnTokens;
}

public Boolean getUmaRptAsJwt() {
return umaRptAsJwt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ private String createResponseAsJwt(JSONObject response, AuthorizationGrant grant
}
}

if (log.isTraceEnabled()) {
log.trace("Response before signing: {}", jwt.getClaims().toJsonString());
}

return jwtSigner.sign().toString();
}

Expand Down Expand Up @@ -288,7 +292,7 @@ private Pair<AuthorizationGrant, Boolean> getAuthorizationGrant(String authoriza
String password = URLDecoder.decode(token.substring(delim + 1), Util.UTF8_STRING_ENCODING);
if (clientService.authenticate(clientId, password)) {
grant = authorizationGrantList.getAuthorizationGrantByAccessToken(accessToken);
if (grant != null && !grant.getClientId().equals(clientId)) {
if (isTrue(appConfiguration.getIntrospectionRestrictBasicAuthnToOwnTokens()) && grant != null && !grant.getClientId().equals(clientId)) {
log.trace("Failed to match grant object clientId and client id provided during authentication.");
return EMPTY;
}
Expand Down

0 comments on commit 38b840c

Please sign in to comment.