public class OAuth2TokenEndpointFilter
extends OncePerRequestFilter
Filter
for the OAuth 2.0 Authorization Code Grant, which handles the processing of the OAuth 2.0 Access Token Request. It converts the OAuth 2.0 Access Token Request to an OAuth2AuthorizationCodeAuthenticationToken
, which is then authenticated by the AuthenticationManager
. If the authentication succeeds, the AuthenticationManager
returns an OAuth2AccessTokenAuthenticationToken
, which contains the OAuth2AccessToken
that is returned in the response. In case of any error, an OAuth2Error
is returned in the response.
By default, this Filter
responds to access token requests at the URI
/oauth2/token
and HttpMethod
POST
.
The default endpoint URI
/oauth2/token
may be overridden via the constructor OAuth2TokenEndpointFilter(AuthenticationManager, OAuth2AuthorizationService, String)
.
AuthenticationManager
, OAuth2AuthorizationService
, Section 4.1 Authorization Code Grant, Section 4.1.3 Access Token RequestModifier and Type | Field and Description |
---|---|
static String | DEFAULT_TOKEN_ENDPOINT_URI The default endpoint URI for access token requests. |
Constructor and Description |
---|
OAuth2TokenEndpointFilter(AuthenticationManager authenticationManager, OAuth2AuthorizationService authorizationService) Constructs an OAuth2TokenEndpointFilter using the provided parameters. |
OAuth2TokenEndpointFilter(AuthenticationManager authenticationManager, OAuth2AuthorizationService authorizationService, String tokenEndpointUri) Constructs an OAuth2TokenEndpointFilter using the provided parameters. |
Modifier and Type | Method and Description |
---|---|
protected void | doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) |
public static final String DEFAULT_TOKEN_ENDPOINT_URI
URI
for access token requests.public OAuth2TokenEndpointFilter(AuthenticationManager authenticationManager, OAuth2AuthorizationService authorizationService)
OAuth2TokenEndpointFilter
using the provided parameters.authenticationManager
- the authentication managerauthorizationService
- the authorization servicepublic OAuth2TokenEndpointFilter(AuthenticationManager authenticationManager, OAuth2AuthorizationService authorizationService, String tokenEndpointUri)
OAuth2TokenEndpointFilter
using the provided parameters.authenticationManager
- the authentication managerauthorizationService
- the authorization servicetokenEndpointUri
- the endpoint URI
for access token requestsprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException
ServletException
IOException