Class OauthController

java.lang.Object
io.micronaut.security.endpoints.OauthController

@Requires(property="micronaut.security.endpoints.oauth.enabled",notEquals="false") @Requires(classes=io.micronaut.http.annotation.Controller.class) @Requires(beans=RefreshTokenPersistence.class) @Requires(beans=RefreshTokenValidator.class) @Controller("${micronaut.security.endpoints.oauth.path:/oauth/access_token}") @Secured("isAnonymous()") public class OauthController extends Object
A controller that handles token refresh.
Since:
1.0
Author:
Sergio del Amo, Graeme Rocher
See Also:
  • Constructor Details

    • OauthController

      public OauthController(RefreshTokenPersistence refreshTokenPersistence, RefreshTokenValidator refreshTokenValidator, OauthControllerConfigurationProperties oauthControllerConfigurationProperties, LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> loginHandler)
      Parameters:
      refreshTokenPersistence - The persistence mechanism for the refresh token
      refreshTokenValidator - The refresh token validator
      oauthControllerConfigurationProperties - The controller configuration
      loginHandler - The login handler
  • Method Details

    • 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 @Nullable Map<String,String> body, @Nullable @CookieValue("JWT_REFRESH_TOKEN") @Nullable String cookieRefreshToken)
      Parameters:
      request - The current request
      body - HTTP Request body which will be mapped to a TokenRefreshRequest.
      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") @Nullable 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