Class OauthController


  • @Requires(property="micronaut.security.endpoints.oauth.enabled",notEquals="false") @Requires(beans=io.micronaut.security.token.refresh.RefreshTokenPersistence.class) @Requires(beans=io.micronaut.security.token.validator.RefreshTokenValidator.class)
    @Controller("${micronaut.security.endpoints.oauth.path:/oauth/access_token}")
    @Secured("isAnonymous()")
    @Validated
    public class OauthController
    extends java.lang.Object
    A controller that handles token refresh.
    Since:
    1.0
    See Also:
    Refreshing an Access token
    • Constructor Summary

      Constructors 
      Constructor Description
      OauthController​(io.micronaut.security.token.refresh.RefreshTokenPersistence refreshTokenPersistence, io.micronaut.security.token.validator.RefreshTokenValidator refreshTokenValidator, OauthControllerConfigurationProperties oauthControllerConfigurationProperties, io.micronaut.security.handlers.LoginHandler loginHandler)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> index​(io.micronaut.http.HttpRequest<?> request, TokenRefreshRequest tokenRefreshRequest, java.lang.String cookieRefreshToken)  
      org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> index​(io.micronaut.http.HttpRequest<?> request, java.lang.String cookieRefreshToken)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OauthController

        public OauthController​(io.micronaut.security.token.refresh.RefreshTokenPersistence refreshTokenPersistence,
                               io.micronaut.security.token.validator.RefreshTokenValidator refreshTokenValidator,
                               OauthControllerConfigurationProperties oauthControllerConfigurationProperties,
                               io.micronaut.security.handlers.LoginHandler loginHandler)
        Parameters:
        refreshTokenPersistence - The persistence mechanism for the refresh token
        refreshTokenValidator - The refresh token validator
        oauthControllerConfigurationProperties - The controller configuration
        loginHandler - The login handler
    • Method Detail

      • index

        @Consumes({"application/x-www-form-urlencoded","application/json"})
        @Post
        @SingleResult
        public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> index​(io.micronaut.http.HttpRequest<?> request,
                                                                                             @Nullable @Body
                                                                                             TokenRefreshRequest tokenRefreshRequest,
                                                                                             @Nullable @CookieValue("JWT_REFRESH_TOKEN")
                                                                                             java.lang.String cookieRefreshToken)
        Parameters:
        request - The current request
        tokenRefreshRequest - An instance of TokenRefreshRequest present in the request
        cookieRefreshToken - The refresh token stored in a cookie
        Returns:
        A response or a failure indicated by the HTTP status
      • index

        @Get
        @SingleResult
        public org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>> index​(io.micronaut.http.HttpRequest<?> request,
                                                                                             @Nullable @CookieValue("JWT_REFRESH_TOKEN")
                                                                                             java.lang.String cookieRefreshToken)
        Parameters:
        request - The current request
        cookieRefreshToken - The refresh token stored in a cookie
        Returns:
        A response or a failure indicated by the HTTP status