Class SessionLoginHandler

java.lang.Object
io.micronaut.security.session.SessionLoginHandler
All Implemented Interfaces:
LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>, RedirectingLoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>

@Requires(condition=SessionAuthenticationModeCondition.class) @Singleton public class SessionLoginHandler extends Object implements RedirectingLoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>
A RedirectingLoginHandler implementation for session based authentication.
Since:
1.0
Author:
Sergio del Amo
  • Field Details

    • loginSuccess

      @Nullable protected final @Nullable String loginSuccess
    • loginFailure

      @Nullable protected final @Nullable String loginFailure
    • redirectConfiguration

      protected final RedirectConfiguration redirectConfiguration
    • sessionStore

      protected final io.micronaut.session.SessionStore<io.micronaut.session.Session> sessionStore
  • Constructor Details

    • SessionLoginHandler

      @Inject public SessionLoginHandler(RedirectConfiguration redirectConfiguration, io.micronaut.session.SessionStore<io.micronaut.session.Session> sessionStore, @Nullable @Nullable PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> priorToLoginPersistence, RedirectService redirectService, List<SessionPopulator<io.micronaut.http.HttpRequest<?>>> sessionPopulators)
      Constructor.
      Parameters:
      redirectConfiguration - Redirect configuration
      sessionStore - The session store
      priorToLoginPersistence - The persistence to store the original url
      redirectService - Redirection Service
      sessionPopulators - Session Populators
    • SessionLoginHandler

      @Deprecated(forRemoval=true, since="4.11.0") public SessionLoginHandler(RedirectConfiguration redirectConfiguration, io.micronaut.session.SessionStore<io.micronaut.session.Session> sessionStore, @Nullable @Nullable PriorToLoginPersistence<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>> priorToLoginPersistence, RedirectService redirectService)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Constructor.
      Parameters:
      redirectConfiguration - Redirect configuration
      sessionStore - The session store
      priorToLoginPersistence - The persistence to store the original url
      redirectService - Redirection Service
  • Method Details

    • loginSuccess

      public io.micronaut.http.MutableHttpResponse<?> loginSuccess(Authentication authentication, io.micronaut.http.HttpRequest<?> request)
      Specified by:
      loginSuccess in interface LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>
      Parameters:
      authentication - Authenticated user's representation.
      request - The HTTP Request being executed
      Returns:
      An HTTP Response. Eg. a redirect or an JWT token rendered to the response
    • loginRefresh

      public io.micronaut.http.MutableHttpResponse<?> loginRefresh(Authentication authentication, String refreshToken, io.micronaut.http.HttpRequest<?> request)
      Specified by:
      loginRefresh in interface LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>
      Parameters:
      authentication - Authenticated user's representation.
      refreshToken - The refresh token
      request - The HTTP Request being executed
      Returns:
      An HTTP Response. Eg. a redirect or an JWT token rendered to the response
    • loginFailed

      public io.micronaut.http.MutableHttpResponse<?> loginFailed(AuthenticationResponse authenticationFailed, io.micronaut.http.HttpRequest<?> request)
      Specified by:
      loginFailed in interface LoginHandler<io.micronaut.http.HttpRequest<?>,io.micronaut.http.MutableHttpResponse<?>>
      Parameters:
      authenticationFailed - Object encapsulates the Login failure
      request - The HTTP Request being executed
      Returns:
      An HTTP Response. Eg. a redirect or 401 response