Using modern Java features
This commit is contained in:
committed by
Josh Cummings
parent
7e01ebdd92
commit
9b603b99ab
@@ -101,10 +101,9 @@ public final class OpaqueTokenAuthenticationProvider implements AuthenticationPr
|
||||
*/
|
||||
@Override
|
||||
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
|
||||
if (!(authentication instanceof BearerTokenAuthenticationToken)) {
|
||||
if (!(authentication instanceof BearerTokenAuthenticationToken bearer)) {
|
||||
return null;
|
||||
}
|
||||
BearerTokenAuthenticationToken bearer = (BearerTokenAuthenticationToken) authentication;
|
||||
OAuth2AuthenticatedPrincipal principal = getOAuth2AuthenticatedPrincipal(bearer);
|
||||
Authentication result = this.authenticationConverter.convert(bearer.getToken(), principal);
|
||||
if (result == null) {
|
||||
|
||||
@@ -74,8 +74,7 @@ public final class BearerTokenAuthenticationEntryPoint implements Authentication
|
||||
if (StringUtils.hasText(error.getUri())) {
|
||||
parameters.put("error_uri", error.getUri());
|
||||
}
|
||||
if (error instanceof BearerTokenError) {
|
||||
BearerTokenError bearerTokenError = (BearerTokenError) error;
|
||||
if (error instanceof BearerTokenError bearerTokenError) {
|
||||
if (StringUtils.hasText(bearerTokenError.getScope())) {
|
||||
parameters.put("scope", bearerTokenError.getScope());
|
||||
}
|
||||
|
||||
@@ -82,8 +82,7 @@ public final class BearerTokenServerAuthenticationEntryPoint implements ServerAu
|
||||
if (StringUtils.hasText(error.getUri())) {
|
||||
parameters.put("error_uri", error.getUri());
|
||||
}
|
||||
if (error instanceof BearerTokenError) {
|
||||
BearerTokenError bearerTokenError = (BearerTokenError) error;
|
||||
if (error instanceof BearerTokenError bearerTokenError) {
|
||||
if (StringUtils.hasText(bearerTokenError.getScope())) {
|
||||
parameters.put("scope", bearerTokenError.getScope());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user