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 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 interface PriorToLoginPersistence<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 interface PriorToLoginPersistence<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 cookie
      request - The current request