Package io.micronaut.security.endpoints
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 Summary
ConstructorDescriptionOauthController
(RefreshTokenPersistence refreshTokenPersistence, RefreshTokenValidator refreshTokenValidator, OauthControllerConfigurationProperties oauthControllerConfigurationProperties, LoginHandler<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> loginHandler) -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>
org.reactivestreams.Publisher<io.micronaut.http.MutableHttpResponse<?>>
index
(io.micronaut.http.HttpRequest<?> request, @Nullable Map<String, String> body, @Nullable String cookieRefreshToken)
-
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 tokenrefreshTokenValidator
- The refresh token validatoroauthControllerConfigurationProperties
- The controller configurationloginHandler
- 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 requestbody
- HTTP Request body which will be mapped to aTokenRefreshRequest
.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 requestcookieRefreshToken
- The refresh token stored in a cookie- Returns:
- A response or a failure indicated by the HTTP status
-