Class DefaultLoginPageGeneratingFilter
java.lang.Object
org.springframework.web.filter.GenericFilterBean
org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter
- All Implemented Interfaces:
jakarta.servlet.Filter,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.DisposableBean,org.springframework.beans.factory.InitializingBean,org.springframework.context.EnvironmentAware,org.springframework.core.env.EnvironmentCapable,org.springframework.web.context.ServletContextAware
public class DefaultLoginPageGeneratingFilter
extends org.springframework.web.filter.GenericFilterBean
For internal use with namespace configuration in the case where a user doesn't
configure a login page. The configuration code will insert this filter in the chain
instead.
Will only work if a redirect is used to the login page.
- Since:
- 2.0
-
Field Summary
FieldsFields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionvoiddoFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) @Nullable StringbooleanvoidsetAuthenticationUrl(String authenticationUrl) voidsetFailureUrl(String failureUrl) voidsetFormLoginEnabled(boolean formLoginEnabled) voidsetLoginPageUrl(String loginPageUrl) voidsetLogoutSuccessUrl(String logoutSuccessUrl) voidsetOauth2AuthenticationUrlToClientName(Map<String, String> oauth2AuthenticationUrlToClientName) voidsetOauth2LoginEnabled(boolean oauth2LoginEnabled) voidsetOneTimeTokenEnabled(boolean oneTimeTokenEnabled) voidsetOneTimeTokenGenerationUrl(String generateOneTimeTokenUrl) voidsetPasskeysEnabled(boolean passkeysEnabled) voidsetPasswordParameter(String passwordParameter) voidsetRememberMeParameter(String rememberMeParameter) voidsetResolveHeaders(Function<jakarta.servlet.http.HttpServletRequest, Map<String, String>> resolveHeaders) Sets a Function used to resolve a Map of the HTTP headers where the key is the name of the header and the value is the value of the header.voidsetResolveHiddenInputs(Function<jakarta.servlet.http.HttpServletRequest, Map<String, String>> resolveHiddenInputs) Sets a Function used to resolve a Map of the hidden inputs where the key is the name of the input and the value is the value of the input.voidsetSaml2AuthenticationUrlToProviderName(Map<String, String> saml2AuthenticationUrlToProviderName) voidsetSaml2LoginEnabled(boolean saml2LoginEnabled) voidsetSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) Use thisSecurityContextHolderStrategyto retrieve authenticated users.voidsetUsernameParameter(String usernameParameter) Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, afterPropertiesSet, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Field Details
-
DEFAULT_LOGIN_PAGE_URL
- See Also:
-
ERROR_PARAMETER_NAME
- See Also:
-
-
Constructor Details
-
DefaultLoginPageGeneratingFilter
public DefaultLoginPageGeneratingFilter() -
DefaultLoginPageGeneratingFilter
-
-
Method Details
-
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy securityContextHolderStrategy) Use thisSecurityContextHolderStrategyto retrieve authenticated users.Uses
SecurityContextHolder.getContextHolderStrategy()by default.- Parameters:
securityContextHolderStrategy- the strategy to use- Since:
- 7.0
-
setResolveHiddenInputs
public void setResolveHiddenInputs(Function<jakarta.servlet.http.HttpServletRequest, Map<String, String>> resolveHiddenInputs) Sets a Function used to resolve a Map of the hidden inputs where the key is the name of the input and the value is the value of the input. Typically this is used to resolve the CSRF token.- Parameters:
resolveHiddenInputs- the function to resolve the inputs
-
setResolveHeaders
public void setResolveHeaders(Function<jakarta.servlet.http.HttpServletRequest, Map<String, String>> resolveHeaders) Sets a Function used to resolve a Map of the HTTP headers where the key is the name of the header and the value is the value of the header. Typically, this is used to resolve the CSRF token.- Parameters:
resolveHeaders- the function to resolve the headers
-
isEnabled
public boolean isEnabled() -
setLogoutSuccessUrl
-
getLoginPageUrl
-
setLoginPageUrl
-
setFailureUrl
-
setFormLoginEnabled
public void setFormLoginEnabled(boolean formLoginEnabled) -
setOauth2LoginEnabled
public void setOauth2LoginEnabled(boolean oauth2LoginEnabled) -
setOneTimeTokenEnabled
public void setOneTimeTokenEnabled(boolean oneTimeTokenEnabled) -
setSaml2LoginEnabled
public void setSaml2LoginEnabled(boolean saml2LoginEnabled) -
setPasskeysEnabled
public void setPasskeysEnabled(boolean passkeysEnabled) -
setAuthenticationUrl
-
setOneTimeTokenGenerationUrl
-
setUsernameParameter
-
setPasswordParameter
-
setRememberMeParameter
-
setOauth2AuthenticationUrlToClientName
-
setSaml2AuthenticationUrlToProviderName
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest request, jakarta.servlet.ServletResponse response, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-