Package io.micronaut.security.errors
Class CookiePriorToLoginPersistence
java.lang.Object
io.micronaut.security.errors.CookiePriorToLoginPersistence
- All Implemented Interfaces:
PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,
io.micronaut.http.MutableHttpResponse<?>>
@Requires(classes=io.micronaut.http.HttpRequest.class) @Requires(property="micronaut.security.redirect.prior-to-login",value="true")
@Singleton
public class CookiePriorToLoginPersistence
extends Object
implements PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>
Stores the last unauthorized URL in a cookie to redirect back to after
logging in.
- Since:
- 2.0.0
- Author:
- James Kleeh
-
Constructor Summary
ConstructorDescriptionCookiePriorToLoginPersistence
(@Nullable TokenCookieConfiguration cookieConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
configure
(io.micronaut.http.cookie.Cookie cookie, io.micronaut.http.HttpRequest<?> request) Configure the cookie.getOriginalUri
(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response) void
onUnauthorized
(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response)
-
Constructor Details
-
CookiePriorToLoginPersistence
public CookiePriorToLoginPersistence(@Nullable @Nullable TokenCookieConfiguration cookieConfiguration)
-
-
Method Details
-
onUnauthorized
public void onUnauthorized(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response) - Specified by:
onUnauthorized
in interfacePriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,
io.micronaut.http.MutableHttpResponse<?>>
-
getOriginalUri
public Optional<URI> getOriginalUri(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.MutableHttpResponse<?> response) - Specified by:
getOriginalUri
in interfacePriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,
io.micronaut.http.MutableHttpResponse<?>>
-
configure
protected void configure(io.micronaut.http.cookie.Cookie cookie, io.micronaut.http.HttpRequest<?> request) Configure the cookie.- Parameters:
cookie
- The cookierequest
- The current request
-