Class DefaultTokenEndpointClient
java.lang.Object
io.micronaut.security.oauth2.endpoint.token.request.DefaultTokenEndpointClient
- All Implemented Interfaces:
TokenEndpointClient
The default implementation of
TokenEndpointClient
.- Since:
- 1.2.0
- Author:
- James Kleeh
-
Constructor Summary
ConstructorDescriptionDefaultTokenEndpointClient
(io.micronaut.context.BeanContext beanContext, io.micronaut.http.client.HttpClientConfiguration defaultClientConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected io.micronaut.http.client.HttpClient
Retrieves a client for the given provider.protected <G,
R extends TokenResponse>
voidsecureRequest
(@NonNull io.micronaut.http.MutableHttpRequest<G> request, TokenRequestContext<G, R> requestContext) Secures the request according to the context's endpoint supported authentication methods.<G,
R extends TokenResponse>
@NonNull org.reactivestreams.Publisher<R>sendRequest
(TokenRequestContext<G, R> requestContext)
-
Constructor Details
-
DefaultTokenEndpointClient
public DefaultTokenEndpointClient(io.micronaut.context.BeanContext beanContext, io.micronaut.http.client.HttpClientConfiguration defaultClientConfiguration) - Parameters:
beanContext
- The bean contextdefaultClientConfiguration
- The default client configuration
-
-
Method Details
-
sendRequest
@NonNull public <G,R extends TokenResponse> @NonNull org.reactivestreams.Publisher<R> sendRequest(TokenRequestContext<G, R> requestContext) - Specified by:
sendRequest
in interfaceTokenEndpointClient
- Type Parameters:
G
- The token request grant or bodyR
- The token response type- Parameters:
requestContext
- The token request context- Returns:
- a HTTP Request to the Token Endpoint with Authorization Code Grant payload.
-
secureRequest
protected <G,R extends TokenResponse> void secureRequest(@NonNull @NonNull io.micronaut.http.MutableHttpRequest<G> request, TokenRequestContext<G, R> requestContext) Secures the request according to the context's endpoint supported authentication methods.- Type Parameters:
G
- The token request grant or bodyR
- The token response type- Parameters:
request
- Token endpoint RequestrequestContext
- The request context
-
getClient
Retrieves a client for the given provider.- Parameters:
providerName
- The provider name- Returns:
- An HTTP client to use to send the request
-