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

feat(oxauth): added configuration property to AS which will allow to bypass basic client authentication restriction to query only own tokens (4.6.0) #1866

Merged
merged 1 commit into from
Oct 16, 2023
Merged
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 @@ -196,6 +196,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 @@ -587,6 +588,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 @@ -55,6 +55,8 @@
import java.nio.charset.StandardCharsets;
import java.util.Iterator;

import static org.apache.commons.lang3.BooleanUtils.isTrue;

/**
* @author Yuriy Zabrovarnyy
* @version June 30, 2018
Expand Down Expand Up @@ -278,13 +280,13 @@ 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;
}
return new Pair<>(grant, true);
} else {
log.trace("Failed to perform basic authentication for client: " + clientId);
log.trace("Failed to perform basic authentication for client: {}", clientId);
}
}
}
Expand Down
Loading