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
Modifier and TypeClassDescriptionstatic class
Forbidden redirect configuration.static class
Forbidden redirect configuration.static class
Unauthorized redirect configuration. -
Field Summary
Modifier and TypeFieldDescriptionstatic final boolean
The default enable value.static final String
The default login failure target URL.static final String
The default login success target URL.static final String
The default logout URL.static final boolean
The default behavior of redirect to the uri prior to login.static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription@NonNull ForbiddenRedirectConfiguration
@NonNull String
@NonNull String
@NonNull String
@NonNull RefreshRedirectConfiguration
@NonNull UnauthorizedRedirectConfiguration
boolean
boolean
void
setEnabled
(boolean enabled) Sets whether Redirection configuration enabled.void
Sets the forbidden redirect configuration.void
setLoginFailure
(@NonNull String loginFailure) Where the user is redirected to after a failed login.void
setLoginSuccess
(@NonNull String loginSuccess) Where the user is redirected to after a successful login.void
URL where the user is redirected after logout.void
setPriorToLogin
(boolean priorToLogin) If true, the user should be redirected back to the unauthorized request that initiated the login flow.void
Sets the refresh redirect configuration.void
setUnauthorized
(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:
getLoginSuccess
in interfaceRedirectConfiguration
- Returns:
- String to be parsed into a URI which represents where the user is redirected to after a successful login.
-
getLoginFailure
- Specified by:
getLoginFailure
in 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:
getLogout
in 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:
getUnauthorized
in 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:
getForbidden
in 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:
getRefresh
in 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-success
configuration for those cases. Default value false.- Parameters:
priorToLogin
- Prior to login setting
-
isPriorToLogin
public boolean isPriorToLogin()- Specified by:
isPriorToLogin
in 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:
isEnabled
in 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
-