java.lang.Object
org.springframework.web.filter.GenericFilterBean
waffle.spring.NegotiateSecurityFilter
- 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
- Direct Known Subclasses:
DelegatingNegotiateSecurityFilter
public class NegotiateSecurityFilter
extends org.springframework.web.filter.GenericFilterBean
A Spring Negotiate security filter.
- Author:
- dblock[at]dblock[dot]org
-
Field Summary
Fields inherited from class org.springframework.web.filter.GenericFilterBean
logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoiddoFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) org.springframework.security.core.GrantedAuthorityGets the default granted authority.Gets the granted authority factory.Gets the principal format.Gets the provider.Gets the role format.booleanChecks if is allow guest login.booleanChecks if is impersonate.protected voidsendUnauthorized(jakarta.servlet.http.HttpServletResponse response, boolean close) Send a 401 Unauthorized along with protocol authentication headers.voidsetAllowGuestLogin(boolean value) Sets the allow guest login.protected booleansetAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication) Invoked when authentication towards ad was succesful to populate securitycontext Override to add service provider authorization checks.voidsetDefaultGrantedAuthority(org.springframework.security.core.GrantedAuthority value) Sets the default granted authority.voidSets the granted authority factory.voidsetImpersonate(boolean value) Enable/Disable impersonation.voidsetPrincipalFormat(String value) Sets the principal format.voidSets the principal format enum.voidSets the provider.voidsetRoleFormat(String value) Sets the role format.voidsetRoleFormatEnum(PrincipalFormat value) Sets the role format enum.Methods inherited from class org.springframework.web.filter.GenericFilterBean
addRequiredProperty, createEnvironment, destroy, getEnvironment, getFilterConfig, getFilterName, getServletContext, init, initBeanWrapper, initFilterBean, setBeanName, setEnvironment, setServletContext
-
Constructor Details
-
NegotiateSecurityFilter
public NegotiateSecurityFilter()Instantiates a new negotiate security filter.
-
-
Method Details
-
doFilter
public void doFilter(jakarta.servlet.ServletRequest req, jakarta.servlet.ServletResponse res, jakarta.servlet.FilterChain chain) throws IOException, jakarta.servlet.ServletException - Throws:
IOExceptionjakarta.servlet.ServletException
-
setAuthentication
protected boolean setAuthentication(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, org.springframework.security.core.Authentication authentication) Invoked when authentication towards ad was succesful to populate securitycontext Override to add service provider authorization checks.- Parameters:
request- the requestresponse- the responseauthentication- the authentication- Returns:
- true, if successful
-
afterPropertiesSet
public void afterPropertiesSet() throws jakarta.servlet.ServletException- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean- Overrides:
afterPropertiesSetin classorg.springframework.web.filter.GenericFilterBean- Throws:
jakarta.servlet.ServletException
-
sendUnauthorized
protected void sendUnauthorized(jakarta.servlet.http.HttpServletResponse response, boolean close) Send a 401 Unauthorized along with protocol authentication headers.- Parameters:
response- HTTP Responseclose- Close connection.
-
getPrincipalFormat
Gets the principal format.- Returns:
- the principal format
-
setPrincipalFormatEnum
Sets the principal format enum.- Parameters:
value- the new principal format enum
-
setPrincipalFormat
Sets the principal format.- Parameters:
value- the new principal format
-
getRoleFormat
Gets the role format.- Returns:
- the role format
-
setRoleFormatEnum
Sets the role format enum.- Parameters:
value- the new role format enum
-
setRoleFormat
Sets the role format.- Parameters:
value- the new role format
-
isAllowGuestLogin
public boolean isAllowGuestLogin()Checks if is allow guest login.- Returns:
- true, if is allow guest login
-
setAllowGuestLogin
public void setAllowGuestLogin(boolean value) Sets the allow guest login.- Parameters:
value- the new allow guest login
-
setImpersonate
public void setImpersonate(boolean value) Enable/Disable impersonation.- Parameters:
value- true to enable impersonation, false otherwise
-
isImpersonate
public boolean isImpersonate()Checks if is impersonate.- Returns:
- true if impersonation is enabled, false otherwise
-
getProvider
Gets the provider.- Returns:
- the provider
-
setProvider
Sets the provider.- Parameters:
value- the new provider
-
getGrantedAuthorityFactory
Gets the granted authority factory.- Returns:
- the granted authority factory
-
setGrantedAuthorityFactory
Sets the granted authority factory.- Parameters:
value- the new granted authority factory
-
getDefaultGrantedAuthority
public org.springframework.security.core.GrantedAuthority getDefaultGrantedAuthority()Gets the default granted authority.- Returns:
- the default granted authority
-
setDefaultGrantedAuthority
public void setDefaultGrantedAuthority(org.springframework.security.core.GrantedAuthority value) Sets the default granted authority.- Parameters:
value- the new default granted authority
-