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 Object
implements RedirectConfiguration
ConfigurationProperties implementation of RedirectConfiguration.- Since:
- 2.0.0
- Author:
- Sergio del Amo
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classForbidden redirect configuration.static classForbidden redirect configuration.static classUnauthorized redirect configuration. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final booleanThe default enable value.static final StringThe default login failure target URL.static final StringThe default login success target URL.static final StringThe default logout URL.static final booleanThe default behavior of redirect to the uri prior to login.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@NonNull ForbiddenRedirectConfiguration@NonNull String@NonNull String@NonNull String@NonNull RefreshRedirectConfiguration@NonNull UnauthorizedRedirectConfigurationbooleanbooleanvoidsetEnabled(boolean enabled) Sets whether Redirection configuration enabled.voidSets the forbidden redirect configuration.voidsetLoginFailure(@NonNull String loginFailure) Where the user is redirected to after a failed login.voidsetLoginSuccess(@NonNull String loginSuccess) Where the user is redirected to after a successful login.voidURL 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.voidSets the refresh redirect configuration.voidsetUnauthorized(RedirectConfigurationProperties.UnauthorizedRedirectConfigurationProperties unauthorized) Sets the unauthorized redirect configuration.
-
Field Details
-
PREFIX
- See Also:
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDThe default enable value.- See Also:
-
DEFAULT_LOGOUT_URL
The default logout URL.- See Also:
-
DEFAULT_LOGIN_SUCCESS
The default login success target URL.- See Also:
-
DEFAULT_LOGIN_FAILURE
The default login failure target URL.- See Also:
-
DEFAULT_PRIOR_TO_LOGIN
public static final boolean DEFAULT_PRIOR_TO_LOGINThe default behavior of redirect to the uri prior to login.- See Also:
-
-
Constructor Details
-
RedirectConfigurationProperties
public RedirectConfigurationProperties()
-
-
Method Details
-
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
- 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
Where the user is redirected to after a successful login. Default value ("/").- Parameters:
loginSuccess- The URL
-
setLoginFailure
Where the user is redirected to after a failed login. Default value ("/").- Parameters:
loginFailure- The URL
-
getLogout
- Specified by:
getLogoutin interfaceRedirectConfiguration- Returns:
- String to be parsed into a URI which represents where the user is redirected to after logout.
-
setLogout
URL where the user is redirected after logout. Default value ("/").- Parameters:
logout- The URL
-
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
- 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
- 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
-