Class RedirectConfigurationProperties

java.lang.Object
io.micronaut.security.config.RedirectConfigurationProperties
All Implemented Interfaces:
io.micronaut.core.util.Toggleable, RedirectConfiguration

@ConfigurationProperties("micronaut.security.redirect") public class RedirectConfigurationProperties extends Object implements RedirectConfiguration
ConfigurationProperties implementation of RedirectConfiguration.
Since:
2.0.0
Author:
Sergio del Amo
  • Field Details

    • PREFIX

      public static final String PREFIX
      See Also:
    • DEFAULT_ENABLED

      public static final boolean DEFAULT_ENABLED
      The default enable value.
      See Also:
    • DEFAULT_LOGOUT_URL

      public static final String DEFAULT_LOGOUT_URL
      The default logout URL.
      See Also:
    • DEFAULT_LOGIN_SUCCESS

      public static final String DEFAULT_LOGIN_SUCCESS
      The default login success target URL.
      See Also:
    • DEFAULT_LOGIN_FAILURE

      public static final String DEFAULT_LOGIN_FAILURE
      The default login failure target URL.
      See Also:
    • DEFAULT_PRIOR_TO_LOGIN

      public static final boolean DEFAULT_PRIOR_TO_LOGIN
      The default behavior of redirect to the uri prior to login.
      See Also:
  • Constructor Details

    • RedirectConfigurationProperties

      public RedirectConfigurationProperties()
  • Method Details

    • getLoginSuccess

      @NonNull public @NonNull String getLoginSuccess()
      Specified by:
      getLoginSuccess in interface RedirectConfiguration
      Returns:
      String to be parsed into a URI which represents where the user is redirected to after a successful login.
    • getLoginFailure

      @NonNull public @NonNull String getLoginFailure()
      Specified by:
      getLoginFailure in interface RedirectConfiguration
      Returns:
      String to be parsed into a URI which represents where the user is redirected to after a failed login.
    • setLoginSuccess

      public void setLoginSuccess(@NonNull @NonNull String loginSuccess)
      Where the user is redirected to after a successful login. Default value ("/").
      Parameters:
      loginSuccess - The URL
    • setLoginFailure

      public void setLoginFailure(@NonNull @NonNull String loginFailure)
      Where the user is redirected to after a failed login. Default value ("/").
      Parameters:
      loginFailure - The URL
    • getLogout

      @NonNull public @NonNull String getLogout()
      Specified by:
      getLogout in interface RedirectConfiguration
      Returns:
      String to be parsed into a URI which represents where the user is redirected to after logout.
    • setLogout

      public void setLogout(@NonNull @NonNull String logout)
      URL where the user is redirected after logout. Default value ("/").
      Parameters:
      logout - The URL
    • getUnauthorized

      @NonNull public @NonNull UnauthorizedRedirectConfiguration getUnauthorized()
      Specified by:
      getUnauthorized in interface RedirectConfiguration
      Returns:
      configuration about where the user is redirected to after trying to access a secured route.
    • setUnauthorized

      Sets the unauthorized redirect configuration.
      Parameters:
      unauthorized - unauthorized redirect configuration.
    • getForbidden

      @NonNull public @NonNull ForbiddenRedirectConfiguration getForbidden()
      Specified by:
      getForbidden in interface RedirectConfiguration
      Returns:
      configuration about where the user is redirected to after trying to access a secured route for which the does not have sufficient roles.
    • setForbidden

      Sets the forbidden redirect configuration.
      Parameters:
      forbidden - forbidden redirect configuration.
    • getRefresh

      @NonNull public @NonNull RefreshRedirectConfiguration getRefresh()
      Specified by:
      getRefresh in interface RedirectConfiguration
      Returns:
      configuration about where the user is redirected to after executing the refresh token endpoint.
    • setRefresh

      Sets the refresh redirect configuration.
      Parameters:
      refresh - refresh redirect configuration.
    • setPriorToLogin

      public void setPriorToLogin(boolean priorToLogin)
      If true, the user should be redirected back to the unauthorized request that initiated the login flow. Supersedes the login-success configuration for those cases. Default value false.
      Parameters:
      priorToLogin - Prior to login setting
    • isPriorToLogin

      public boolean isPriorToLogin()
      Specified by:
      isPriorToLogin in interface RedirectConfiguration
      Returns:
      If the user attempted to access a URL while unauthenticated, and was subsequently redirected to login, redirect back to that URL post login (true). Use the static login success URL (false).
    • isEnabled

      public boolean isEnabled()
      Specified by:
      isEnabled in interface io.micronaut.core.util.Toggleable
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether Redirection configuration enabled. Default value (true).
      Parameters:
      enabled - True if it is