Use OAuth2ErrorCodes.UNSUPPORTED_TOKEN_TYPE
Issue gh-83
This commit is contained in:
parent
ebcdf7989d
commit
cb09aef605
@ -74,8 +74,7 @@ public class OAuth2TokenRevocationAuthenticationProvider implements Authenticati
|
||||
} else if (TokenType.ACCESS_TOKEN.getValue().equals(tokenTypeHint)) {
|
||||
tokenType = TokenType.ACCESS_TOKEN;
|
||||
} else {
|
||||
// TODO Add OAuth2ErrorCodes.UNSUPPORTED_TOKEN_TYPE
|
||||
throw new OAuth2AuthenticationException(new OAuth2Error("unsupported_token_type"));
|
||||
throw new OAuth2AuthenticationException(new OAuth2Error(OAuth2ErrorCodes.UNSUPPORTED_TOKEN_TYPE));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,12 +100,12 @@ public class OAuth2TokenRevocationAuthenticationProviderTests {
|
||||
RegisteredClient registeredClient = TestRegisteredClients.registeredClient().build();
|
||||
OAuth2ClientAuthenticationToken clientPrincipal = new OAuth2ClientAuthenticationToken(registeredClient);
|
||||
OAuth2TokenRevocationAuthenticationToken authentication = new OAuth2TokenRevocationAuthenticationToken(
|
||||
"token", clientPrincipal, "unsupported_token_type");
|
||||
"token", clientPrincipal, OAuth2ErrorCodes.UNSUPPORTED_TOKEN_TYPE);
|
||||
assertThatThrownBy(() -> this.authenticationProvider.authenticate(authentication))
|
||||
.isInstanceOf(OAuth2AuthenticationException.class)
|
||||
.extracting(ex -> ((OAuth2AuthenticationException) ex).getError())
|
||||
.extracting("errorCode")
|
||||
.isEqualTo("unsupported_token_type");
|
||||
.isEqualTo(OAuth2ErrorCodes.UNSUPPORTED_TOKEN_TYPE);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user