Class AuthenticationHeadersLoginProcessor
- java.lang.Object
-
- org.craftercms.security.processors.impl.AuthenticationHeadersLoginProcessor
-
- All Implemented Interfaces:
RequestSecurityProcessor
public class AuthenticationHeadersLoginProcessor extends Object implements RequestSecurityProcessor
RequestSecurityProcessorthat auto logins a user through the headers provided by the Apache mod_auth_mellon SAML authentication module. If the user doesn't exist, it creates it.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthenticationManagerauthenticationManagerstatic StringDEFAULT_EMAIL_HEADER_NAMEstatic StringDEFAULT_MELLON_HEADER_PREFIXstatic StringDEFAULT_TOKEN_HEADER_NAMEstatic StringDEFAULT_USERNAME_HEADER_NAMEprotected StringemailHeaderNamestatic org.slf4j.Loggerloggerprotected StringmellonHeaderPrefixprotected ProfileServiceprofileServiceprotected TenantServicetenantServiceprotected TenantsResolvertenantsResolverprotected StringtokenExpectedValueprotected StringtokenHeaderNameprotected StringusernameHeaderName
-
Constructor Summary
Constructors Constructor Description AuthenticationHeadersLoginProcessor()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ProfilecreateProfileWithSsoInfo(String username, Tenant tenant, javax.servlet.http.HttpServletRequest request)protected TenantgetSsoEnabledTenant(String[] tenantNames)StringgetTokenExpectedValue()protected booleanhasValidToken(javax.servlet.http.HttpServletRequest request)voidprocessRequest(org.craftercms.commons.http.RequestContext context, RequestSecurityProcessorChain processorChain)Processes a request, enforcing security when required.voidsetAuthenticationManager(AuthenticationManager authenticationManager)voidsetEmailHeaderName(String emailHeaderName)voidsetMellonHeaderPrefix(String mellonHeaderPrefix)voidsetProfileService(ProfileService profileService)voidsetTenantService(TenantService tenantService)voidsetTenantsResolver(TenantsResolver tenantsResolver)voidsetTokenExpectedValue(String tokenExpectedValue)voidsetTokenHeaderName(String tokenHeaderName)voidsetUsernameHeaderName(String usernameHeaderName)
-
-
-
Field Detail
-
logger
public static final org.slf4j.Logger logger
-
DEFAULT_MELLON_HEADER_PREFIX
public static final String DEFAULT_MELLON_HEADER_PREFIX
- See Also:
- Constant Field Values
-
DEFAULT_USERNAME_HEADER_NAME
public static final String DEFAULT_USERNAME_HEADER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_EMAIL_HEADER_NAME
public static final String DEFAULT_EMAIL_HEADER_NAME
- See Also:
- Constant Field Values
-
DEFAULT_TOKEN_HEADER_NAME
public static final String DEFAULT_TOKEN_HEADER_NAME
- See Also:
- Constant Field Values
-
tenantService
protected TenantService tenantService
-
profileService
protected ProfileService profileService
-
tenantsResolver
protected TenantsResolver tenantsResolver
-
authenticationManager
protected AuthenticationManager authenticationManager
-
mellonHeaderPrefix
protected String mellonHeaderPrefix
-
usernameHeaderName
protected String usernameHeaderName
-
emailHeaderName
protected String emailHeaderName
-
tokenHeaderName
protected String tokenHeaderName
-
tokenExpectedValue
protected String tokenExpectedValue
-
-
Method Detail
-
setTenantService
public void setTenantService(TenantService tenantService)
-
setProfileService
public void setProfileService(ProfileService profileService)
-
setTenantsResolver
public void setTenantsResolver(TenantsResolver tenantsResolver)
-
setAuthenticationManager
public void setAuthenticationManager(AuthenticationManager authenticationManager)
-
setMellonHeaderPrefix
public void setMellonHeaderPrefix(String mellonHeaderPrefix)
-
setUsernameHeaderName
public void setUsernameHeaderName(String usernameHeaderName)
-
setEmailHeaderName
public void setEmailHeaderName(String emailHeaderName)
-
setTokenHeaderName
public void setTokenHeaderName(String tokenHeaderName)
-
setTokenExpectedValue
public void setTokenExpectedValue(String tokenExpectedValue)
-
getTokenExpectedValue
public String getTokenExpectedValue()
-
processRequest
public void processRequest(org.craftercms.commons.http.RequestContext context, RequestSecurityProcessorChain processorChain) throws ExceptionDescription copied from interface:RequestSecurityProcessorProcesses a request, enforcing security when required.- Specified by:
processRequestin interfaceRequestSecurityProcessor- Parameters:
context- the context which holds the current request and responseprocessorChain- theRequestSecurityProcessorChain, used to call the next processor- Throws:
Exception
-
hasValidToken
protected boolean hasValidToken(javax.servlet.http.HttpServletRequest request)
-
getSsoEnabledTenant
protected Tenant getSsoEnabledTenant(String[] tenantNames) throws ProfileException
- Throws:
ProfileException
-
createProfileWithSsoInfo
protected Profile createProfileWithSsoInfo(String username, Tenant tenant, javax.servlet.http.HttpServletRequest request) throws ProfileException
- Throws:
ProfileException
-
-