diff --git a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProvider.java b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProvider.java index 7816ed8..f9ec7eb 100644 --- a/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProvider.java +++ b/oauth2-authorization-server/src/main/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProvider.java @@ -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)); } } diff --git a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProviderTests.java b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProviderTests.java index 4f71220..7b951a8 100644 --- a/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProviderTests.java +++ b/oauth2-authorization-server/src/test/java/org/springframework/security/oauth2/server/authorization/authentication/OAuth2TokenRevocationAuthenticationProviderTests.java @@ -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