Skip to content

Commit

Permalink
[ELY-2362] Small fixes for bearer-only support
Browse files Browse the repository at this point in the history
  • Loading branch information
fjuma committed Jul 26, 2022
1 parent 8def1a1 commit 88649d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Expand Up @@ -152,7 +152,7 @@ private AuthOutcome doAuthenticate() {
log.debug("NOT_ATTEMPTED: bearer only");
return AuthOutcome.NOT_ATTEMPTED;
}
if (isAutodetectedBearerOnly(facade.getRequest())) {
if (isAutodetectedBearerOnly()) {
challenge = bearer.getChallenge();
log.debug("NOT_ATTEMPTED: Treating as bearer only");
return AuthOutcome.NOT_ATTEMPTED;
Expand Down Expand Up @@ -214,7 +214,7 @@ protected void completeAuthentication(BearerTokenRequestAuthenticator bearer) {
log.debugv("User ''{0}'' invoking ''{1}'' on client ''{2}''", principal.getName(), facade.getRequest().getURI(), deployment.getResourceName());
}

protected boolean isAutodetectedBearerOnly(OidcHttpFacade.Request request) {
protected boolean isAutodetectedBearerOnly() {
if (! deployment.isAutodetectBearerOnly()) return false;

String headerValue = facade.getRequest().getHeader(X_REQUESTED_WITH);
Expand Down
Expand Up @@ -269,14 +269,8 @@ public static AccessAndIDTokenResponse getBearerToken(OidcClientConfiguration oi
if (entity == null) {
throw log.noMessageEntity();
}
InputStream is = entity.getContent();
try {
try (InputStream is = entity.getContent()) {
tokenResponse = JsonSerialization.readValue(is, AccessAndIDTokenResponse.class);
} finally {
try {
is.close();
} catch (java.io.IOException ignored) {
}
}
return tokenResponse;
}
Expand Down

0 comments on commit 88649d7

Please sign in to comment.