oauth2/oauth2-resource-server/src/main/java/org/springframework/security/oauth2/server/resource/authentication/OAuth2IntrospectionAuthenticationProvider.java
@Override
	public Authentication authenticate(Authentication authentication) throws AuthenticationException {
		if (!(authentication instanceof BearerTokenAuthenticationToken)) {
			return null;
		}
		BearerTokenAuthenticationToken bearer = (BearerTokenAuthenticationToken) authentication;

		Map<String, Object> claims;
		try {
			claims = this.introspectionClient.introspect(bearer.getToken());
		} catch (OAuth2IntrospectionException failed) {
			OAuth2Error invalidToken = invalidToken(failed.getMessage());
			throw new OAuth2AuthenticationException(invalidToken);
		}

		AbstractAuthenticationToken result = convert(bearer.getToken(), claims);
		result.setDetails(bearer.getDetails());
		return result;
	}
@Override
	public Authentication authenticate(Authentication authentication) throws AuthenticationException {
		if (!(authentication instanceof BearerTokenAuthenticationToken)) {
			return null;
		}
		BearerTokenAuthenticationToken bearer = (BearerTokenAuthenticationToken) authentication;

		Map<String, Object> claims;
		try {
			claims = this.introspectionClient.introspect(bearer.getToken());
		} catch (OAuth2IntrospectionException failed) {
			OAuth2Error invalidToken = invalidToken(failed.getMessage());
			throw new OAuth2AuthenticationException(invalidToken);
		}

		AbstractAuthenticationToken result = convert(bearer.getToken(), claims);
		result.setDetails(bearer.getDetails());
		return result;
	}
@ Override public Authentication authenticate ( Authentication authentication ) throws AuthenticationException { if ( ! ( authentication instanceof BearerTokenAuthenticationToken ) ) { return null ; } BearerTokenAuthenticationToken bearer = ( BearerTokenAuthenticationToken ) authentication ; Map < String , Object > claims ; try { claims = this . introspectionClient . introspect ( bearer . getToken ( ) ) ; } catch ( OAuth2IntrospectionException failed ) { OAuth2Error invalidToken = invalidToken ( failed . getMessage ( ) ) ; throw new OAuth2AuthenticationException ( invalidToken ) ; } AbstractAuthenticationToken result = convert ( bearer . getToken ( ) , claims ) ; result . setDetails ( bearer . getDetails ( ) ) ; return result ; }
Introspect and validate the opaque
<a href="https://tools.ietf.org/html/rfc6750#section-1.2" target="_blank">Bearer Token</a>.

@param authentication the authentication request object.

@return A successful authentication
@throws AuthenticationException if authentication failed for some reason
Introspect and validate the opaque <a href = https : // tools . ietf . org / html / rfc6750#section - 1 . 2 target = _blank > Bearer Token< / a > .