Package io.micronaut.security.config
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 java.lang.Object implements RedirectConfigurationConfigurationPropertiesimplementation ofRedirectConfiguration.- Since:
- 2.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRedirectConfigurationProperties.ForbiddenRedirectConfigurationPropertiesForbidden redirect configuration.static classRedirectConfigurationProperties.RefreshRedirectConfigurationPropertiesForbidden redirect configuration.static classRedirectConfigurationProperties.UnauthorizedRedirectConfigurationPropertiesUnauthorized redirect configuration.
-
Field Summary
Fields Modifier and Type Field Description static booleanDEFAULT_ENABLEDThe default enable value.static java.lang.StringDEFAULT_LOGIN_FAILUREThe default login failure target URL.static java.lang.StringDEFAULT_LOGIN_SUCCESSThe default login success target URL.static java.lang.StringDEFAULT_LOGOUT_URLThe default logout URL.static booleanDEFAULT_PRIOR_TO_LOGINThe default behavior of redirect to the uri prior to login.static java.lang.StringPREFIX
-
Constructor Summary
Constructors Constructor Description RedirectConfigurationProperties()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ForbiddenRedirectConfigurationgetForbidden()java.lang.StringgetLoginFailure()java.lang.StringgetLoginSuccess()java.lang.StringgetLogout()RefreshRedirectConfigurationgetRefresh()UnauthorizedRedirectConfigurationgetUnauthorized()booleanisEnabled()booleanisPriorToLogin()voidsetEnabled(boolean enabled)Sets whether Redirection configuration enabled.voidsetForbidden(RedirectConfigurationProperties.ForbiddenRedirectConfigurationProperties forbidden)Sets the forbidden redirect configuration.voidsetLoginFailure(java.lang.String loginFailure)Where the user is redirected to after a failed login.voidsetLoginSuccess(java.lang.String loginSuccess)Where the user is redirected to after a successful login.voidsetLogout(java.lang.String logout)URL where the user is redirected after logout.voidsetPriorToLogin(boolean priorToLogin)If true, the user should be redirected back to the unauthorized request that initiated the login flow.voidsetRefresh(RedirectConfigurationProperties.RefreshRedirectConfigurationProperties refresh)Sets the refresh redirect configuration.voidsetUnauthorized(RedirectConfigurationProperties.UnauthorizedRedirectConfigurationProperties unauthorized)Sets the unauthorized redirect configuration.
-
-
-
Field Detail
-
PREFIX
public static final java.lang.String PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLED
The default enable value.- See Also:
- Constant Field Values
-
DEFAULT_LOGOUT_URL
public static final java.lang.String DEFAULT_LOGOUT_URL
The default logout URL.- See Also:
- Constant Field Values
-
DEFAULT_LOGIN_SUCCESS
public static final java.lang.String DEFAULT_LOGIN_SUCCESS
The default login success target URL.- See Also:
- Constant Field Values
-
DEFAULT_LOGIN_FAILURE
public static final java.lang.String DEFAULT_LOGIN_FAILURE
The default login failure target URL.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
-
Method Detail
-
getLoginSuccess
@NonNull public java.lang.String getLoginSuccess()
- Specified by:
getLoginSuccessin interfaceRedirectConfiguration- Returns:
- String to be parsed into a URI which represents where the user is redirected to after a successful login.
-
getLoginFailure
@NonNull public java.lang.String getLoginFailure()
- Specified by:
getLoginFailurein interfaceRedirectConfiguration- 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 java.lang.String loginSuccess)Where the user is redirected to after a successful login. Default value ("/").- Parameters:
loginSuccess- The URL
-
setLoginFailure
public void setLoginFailure(@NonNull java.lang.String loginFailure)Where the user is redirected to after a failed login. Default value ("/").- Parameters:
loginFailure- The URL
-
getLogout
@NonNull public java.lang.String getLogout()
- Specified by:
getLogoutin interfaceRedirectConfiguration- Returns:
- String to be parsed into a URI which represents where the user is redirected to after logout.
-
setLogout
public void setLogout(@NonNull java.lang.String logout)URL where the user is redirected after logout. Default value ("/").- Parameters:
logout- The URL
-
getUnauthorized
@NonNull public UnauthorizedRedirectConfiguration getUnauthorized()
- Specified by:
getUnauthorizedin interfaceRedirectConfiguration- Returns:
- configuration about where the user is redirected to after trying to access a secured route.
-
setUnauthorized
public void setUnauthorized(RedirectConfigurationProperties.UnauthorizedRedirectConfigurationProperties unauthorized)
Sets the unauthorized redirect configuration.- Parameters:
unauthorized- unauthorized redirect configuration.
-
getForbidden
@NonNull public ForbiddenRedirectConfiguration getForbidden()
- Specified by:
getForbiddenin interfaceRedirectConfiguration- 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
public void setForbidden(RedirectConfigurationProperties.ForbiddenRedirectConfigurationProperties forbidden)
Sets the forbidden redirect configuration.- Parameters:
forbidden- forbidden redirect configuration.
-
getRefresh
@NonNull public RefreshRedirectConfiguration getRefresh()
- Specified by:
getRefreshin interfaceRedirectConfiguration- Returns:
- configuration about where the user is redirected to after executing the refresh token endpoint.
-
setRefresh
public void setRefresh(RedirectConfigurationProperties.RefreshRedirectConfigurationProperties refresh)
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 thelogin-successconfiguration for those cases. Default value false.- Parameters:
priorToLogin- Prior to login setting
-
isPriorToLogin
public boolean isPriorToLogin()
- Specified by:
isPriorToLoginin interfaceRedirectConfiguration- 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:
isEnabledin interfaceio.micronaut.core.util.Toggleable
-
setEnabled
public void setEnabled(boolean enabled)
Sets whether Redirection configuration enabled. Default value (true).- Parameters:
enabled- True if it is
-
-