Class WebClientAccessTokenRetriever
- java.lang.Object
-
- org.bremersee.web.reactive.function.client.AbstractWebClientErrorDecoder<org.springframework.security.core.AuthenticationException>
-
- org.bremersee.security.authentication.WebClientAccessTokenRetriever
-
- All Implemented Interfaces:
Function<org.springframework.web.reactive.function.client.ClientResponse,reactor.core.publisher.Mono<? extends Throwable>>
,AccessTokenRetriever<reactor.core.publisher.Mono<String>>
,WebClientErrorDecoder<org.springframework.security.core.AuthenticationException>
public class WebClientAccessTokenRetriever extends AbstractWebClientErrorDecoder<org.springframework.security.core.AuthenticationException> implements AccessTokenRetriever<reactor.core.publisher.Mono<String>>
A reactive implementation of theAccessTokenRetriever
.- Author:
- Christian Bremer
-
-
Constructor Summary
Constructors Constructor Description WebClientAccessTokenRetriever()
Instantiates a new access token retriever that uses spring's web client.WebClientAccessTokenRetriever(ReactiveAccessTokenCache accessTokenCache)
Instantiates a new access token retriever that uses spring's web client.WebClientAccessTokenRetriever(org.springframework.web.reactive.function.client.WebClient webClient)
Instantiates a new access token retriever that uses spring's web client.WebClientAccessTokenRetriever(org.springframework.web.reactive.function.client.WebClient webClient, ReactiveAccessTokenCache accessTokenCache)
Instantiates a new access token retriever that uses spring's web client.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.springframework.security.core.AuthenticationException
buildException(org.springframework.web.reactive.function.client.ClientResponse clientResponse, String response)
Build exception.reactor.core.publisher.Mono<String>
retrieveAccessToken(AccessTokenRetrieverProperties properties)
Retrieve the access token from the identity provider.-
Methods inherited from class org.bremersee.web.reactive.function.client.AbstractWebClientErrorDecoder
apply
-
-
-
-
Constructor Detail
-
WebClientAccessTokenRetriever
public WebClientAccessTokenRetriever()
Instantiates a new access token retriever that uses spring's web client.
-
WebClientAccessTokenRetriever
public WebClientAccessTokenRetriever(ReactiveAccessTokenCache accessTokenCache)
Instantiates a new access token retriever that uses spring's web client.- Parameters:
accessTokenCache
- the access token cache
-
WebClientAccessTokenRetriever
public WebClientAccessTokenRetriever(org.springframework.web.reactive.function.client.WebClient webClient)
Instantiates a new access token retriever that uses spring's web client.- Parameters:
webClient
- the web client
-
WebClientAccessTokenRetriever
public WebClientAccessTokenRetriever(org.springframework.web.reactive.function.client.WebClient webClient, ReactiveAccessTokenCache accessTokenCache)
Instantiates a new access token retriever that uses spring's web client.- Parameters:
webClient
- the web clientaccessTokenCache
- the access token cache
-
-
Method Detail
-
retrieveAccessToken
public reactor.core.publisher.Mono<String> retrieveAccessToken(AccessTokenRetrieverProperties properties)
Description copied from interface:AccessTokenRetriever
Retrieve the access token from the identity provider.- Specified by:
retrieveAccessToken
in interfaceAccessTokenRetriever<reactor.core.publisher.Mono<String>>
- Parameters:
properties
- the request properties- Returns:
- the access token
-
buildException
public org.springframework.security.core.AuthenticationException buildException(org.springframework.web.reactive.function.client.ClientResponse clientResponse, String response)
Description copied from interface:WebClientErrorDecoder
Build exception.- Specified by:
buildException
in interfaceWebClientErrorDecoder<org.springframework.security.core.AuthenticationException>
- Parameters:
clientResponse
- the client responseresponse
- the response- Returns:
- the exception
-
-