Class WebClientAccessTokenRetriever

  • All Implemented Interfaces:
    Function<org.springframework.web.reactive.function.client.ClientResponse,​reactor.core.publisher.Mono<? extends Throwable>>, org.bremersee.security.authentication.AccessTokenRetriever<reactor.core.publisher.Mono<String>>, WebClientErrorDecoder<org.springframework.security.core.AuthenticationException>

    public class WebClientAccessTokenRetriever
    extends AbstractWebClientErrorDecoder<org.springframework.security.core.AuthenticationException>
    implements org.bremersee.security.authentication.AccessTokenRetriever<reactor.core.publisher.Mono<String>>
    A reactive implementation of the AccessTokenRetriever.
    Author:
    Christian Bremer
    • 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 client
        accessTokenCache - the access token cache
    • Method Detail

      • retrieveAccessToken

        public reactor.core.publisher.Mono<String> retrieveAccessToken​(org.bremersee.security.authentication.AccessTokenRetrieverProperties properties)
        Specified by:
        retrieveAccessToken in interface org.bremersee.security.authentication.AccessTokenRetriever<reactor.core.publisher.Mono<String>>
      • 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 interface WebClientErrorDecoder<org.springframework.security.core.AuthenticationException>
        Parameters:
        clientResponse - the client response
        response - the response
        Returns:
        the exception