Class IdTokenLoginHandler
java.lang.Object
io.micronaut.security.token.cookie.CookieLoginHandler
io.micronaut.security.oauth2.endpoint.token.response.IdTokenLoginHandler
- All Implemented Interfaces:
LoginHandler<io.micronaut.http.HttpRequest<?>,
,io.micronaut.http.MutableHttpResponse<?>> RedirectingLoginHandler<io.micronaut.http.HttpRequest<?>,
io.micronaut.http.MutableHttpResponse<?>>
@Requires(property="micronaut.security.authentication",value="idtoken") @Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
public class IdTokenLoginHandler
extends CookieLoginHandler
Sets
CookieLoginHandler
`s cookie value to the idtoken received from an authentication provider.
The cookie expiration is set to the expiration of the IDToken exp claim.- Since:
- 2.0.0
- Author:
- Sergio del Amo
-
Field Summary
Fields inherited from class io.micronaut.security.token.cookie.CookieLoginHandler
accessTokenCookieConfiguration, loginFailure, loginSuccess, priorToLoginPersistence, refresh
-
Constructor Summary
ConstructorDescriptionIdTokenLoginHandler
(AccessTokenCookieConfiguration accessTokenCookieConfiguration, RedirectConfiguration redirectConfiguration, RedirectService redirectService, @Nullable PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> priorToLoginPersistence) -
Method Summary
Modifier and TypeMethodDescriptionprotected Duration
cookieExpiration
(Authentication authentication, io.micronaut.http.HttpRequest<?> request) List<io.micronaut.http.cookie.Cookie>
getCookies
(Authentication authentication, io.micronaut.http.HttpRequest<?> request) Return the cookies for the given parameters.List<io.micronaut.http.cookie.Cookie>
getCookies
(Authentication authentication, String refreshToken, io.micronaut.http.HttpRequest<?> request) Return the cookies for the given parameters.parseIdToken
(Authentication authentication) Methods inherited from class io.micronaut.security.token.cookie.CookieLoginHandler
applyCookies, createRefreshResponse, createSuccessResponse, loginFailed, loginRefresh, loginSuccess
-
Constructor Details
-
IdTokenLoginHandler
public IdTokenLoginHandler(AccessTokenCookieConfiguration accessTokenCookieConfiguration, RedirectConfiguration redirectConfiguration, RedirectService redirectService, @Nullable @Nullable PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>, io.micronaut.http.MutableHttpResponse<?>> priorToLoginPersistence) - Parameters:
accessTokenCookieConfiguration
- Access token cookie configurationredirectConfiguration
- Redirect configurationredirectService
- Redirect servicepriorToLoginPersistence
- The prior to login persistence strategy
-
-
Method Details
-
getCookies
public List<io.micronaut.http.cookie.Cookie> getCookies(Authentication authentication, io.micronaut.http.HttpRequest<?> request) Return the cookies for the given parameters. This method will generate new cookies based on the current configuration.- Specified by:
getCookies
in classCookieLoginHandler
- Parameters:
authentication
- The Authenticated user's representationrequest
- The current request- Returns:
- A list of cookies
-
getCookies
public List<io.micronaut.http.cookie.Cookie> getCookies(Authentication authentication, String refreshToken, io.micronaut.http.HttpRequest<?> request) Return the cookies for the given parameters. This method will generate new cookies based on the current configuration.- Specified by:
getCookies
in classCookieLoginHandler
- Parameters:
authentication
- The Authenticated user's representationrefreshToken
- The access refresh tokenrequest
- The current request- Returns:
- A list of cookies
-
parseIdToken
- Parameters:
authentication
- User Details- Returns:
- parse the idtoken from the user details attributes
-
cookieExpiration
protected Duration cookieExpiration(Authentication authentication, io.micronaut.http.HttpRequest<?> request) - Parameters:
authentication
- User Detailsrequest
- The current request- Returns:
- the expiration of the providers JWT
-