Class BearerTokenAuthenticationEntryPoint
java.lang.Object
org.springframework.security.oauth2.server.resource.web.BearerTokenAuthenticationEntryPoint
- All Implemented Interfaces:
AuthenticationEntryPoint
public final class BearerTokenAuthenticationEntryPoint
extends Object
implements AuthenticationEntryPoint
An
AuthenticationEntryPoint implementation used to commence authentication of
protected resource requests using BearerTokenAuthenticationFilter.
Uses information provided by BearerTokenError to set HTTP response status code
and populate WWW-Authenticate HTTP header.
- Since:
- 5.1
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcommence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authException) Collect error details from the provided parameters and format according to RFC 6750, specificallyerror,error_description,error_uri, andscope.voidsetRealmName(@Nullable String realmName) Set the default realm name to use in the bearer token error responsevoidsetResourceMetadataParameterResolver(Function<jakarta.servlet.http.HttpServletRequest, String> resourceMetadataParameterResolver) Set the resolver to compute theresource_metadataparameter from the request.
-
Constructor Details
-
BearerTokenAuthenticationEntryPoint
public BearerTokenAuthenticationEntryPoint()
-
-
Method Details
-
commence
public void commence(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, AuthenticationException authException) Collect error details from the provided parameters and format according to RFC 6750, specificallyerror,error_description,error_uri, andscope.- Specified by:
commencein interfaceAuthenticationEntryPoint- Parameters:
request- that resulted in anAuthenticationExceptionresponse- so that the user agent can begin authenticationauthException- that caused the invocation
-
setRealmName
Set the default realm name to use in the bearer token error response- Parameters:
realmName- the realm name, ornull
-
setResourceMetadataParameterResolver
-