Package org.gatein.sso.saml.plugin.valve
Class BaseFormAuthenticator
java.lang.Object
org.apache.catalina.util.LifecycleBase
org.apache.catalina.util.LifecycleMBeanBase
org.apache.catalina.valves.ValveBase
org.apache.catalina.authenticator.AuthenticatorBase
org.apache.catalina.authenticator.FormAuthenticator
org.gatein.sso.saml.plugin.valve.BaseFormAuthenticator
- All Implemented Interfaces:
MBeanRegistration,javax.security.auth.message.config.RegistrationListener,org.apache.catalina.Authenticator,org.apache.catalina.Contained,org.apache.catalina.JmxEnabled,org.apache.catalina.Lifecycle,org.apache.catalina.Valve
- Direct Known Subclasses:
AbstractSPFormAuthenticator
public abstract class BaseFormAuthenticator
extends org.apache.catalina.authenticator.FormAuthenticator
Base Class for Service Provider Form Authenticators
forked from org.picketlink.identity.federation.bindings.tomcat.sp.BaseFormAuthenticator
and made compatible with Tomcat 8.5 since picketlink doesn't provide such a support
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.catalina.authenticator.AuthenticatorBase
org.apache.catalina.authenticator.AuthenticatorBase.AllowCorsPreflightNested classes/interfaces inherited from interface org.apache.catalina.Lifecycle
org.apache.catalina.Lifecycle.SingleUse -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.picketlink.identity.federation.core.audit.PicketLinkAuditHelperprotected Stringprotected org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChainprotected LockA Lock for Handler operations in the chainprotected Stringprotected org.picketlink.identity.federation.web.util.SAMLConfigurationProviderThe user can inject a fully qualified name of aSAMLConfigurationProviderprotected booleanprotected Stringprotected Stringprotected X509CertificateIf the service provider is configured with an IDP metadata file, then this certificate can be picked up from the metadataprotected Stringprotected org.picketlink.identity.federation.core.interfaces.TrustKeyManagerprotected static final org.picketlink.common.PicketLinkLoggerprotected org.picketlink.config.federation.PicketLinkTypeprotected Stringprotected booleanprotected Stringprotected org.picketlink.config.federation.SPTypeprotected Timerprotected intFields inherited from class org.apache.catalina.authenticator.FormAuthenticator
characterEncoding, landingPageFields inherited from class org.apache.catalina.authenticator.AuthenticatorBase
alwaysUseSession, AUTH_HEADER_NAME, cache, changeSessionIdOnAuthentication, context, disableProxyCaching, jaspicCallbackHandlerClass, REALM_NAME, securePagesWithPragma, secureRandomAlgorithm, secureRandomClass, secureRandomProvider, sendAuthInfoResponseHeaders, sessionIdGenerator, sm, ssoFields inherited from class org.apache.catalina.valves.ValveBase
asyncSupported, container, containerLog, nextFields inherited from class org.apache.catalina.util.LifecycleMBeanBase
mserverFields inherited from interface org.apache.catalina.Lifecycle
AFTER_DESTROY_EVENT, AFTER_INIT_EVENT, AFTER_START_EVENT, AFTER_STOP_EVENT, BEFORE_DESTROY_EVENT, BEFORE_INIT_EVENT, BEFORE_START_EVENT, BEFORE_STOP_EVENT, CONFIGURE_START_EVENT, CONFIGURE_STOP_EVENT, PERIODIC_EVENT, START_EVENT, STOP_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanIndicates if digital signatures/validation of SAML assertions are enabled.protected abstract StringReturn the SAML Binding that this authenticator supportsGet the name of the configuration fileorg.picketlink.config.federation.SPTypeGet theSPTypeGet the Identity URLGet theX509Certificateof the IDP if provided via the IDP metadata fileprotected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorTypegetIDPSSODescriptor(org.picketlink.identity.federation.saml.v2.metadata.EntitiesDescriptorType entities) protected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorTypehandleMetadata(org.picketlink.identity.federation.saml.v2.metadata.EntitiesDescriptorType entities) protected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorTypehandleMetadata(org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType entityDescriptor) protected voidprotected abstract voidinitKeyProvider(org.apache.catalina.Context context) protected booleanlocalAuthentication(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response, org.apache.tomcat.util.descriptor.web.LoginConfig loginConfig) Fall back on local authentication at the service provider sideprotected voidprotected voidProcess the configuration from the configuration fileprotected voidprocessIDPMetadataFile(String idpMetadataFile) Attempt to process a metadata file available locallyprotected voidsendToLogoutPage(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response, org.apache.catalina.Session session) voidsetAuditHelper(org.picketlink.identity.federation.core.audit.PicketLinkAuditHelper auditHelper) voidsetConfigFile(String configFile) Set the name of the configuration filevoidSet theSAMLConfigurationProviderfqnvoidsetConfigProvider(org.picketlink.identity.federation.web.util.SAMLConfigurationProvider configProvider) Set an instance of theSAMLConfigurationProvidervoidsetIdpAddress(String idpAddress) If the request.getRemoteAddr is not exactly the IDP address that you have keyed in your deployment descriptor for keystore alias, you can set it here explicitlyvoidsetIssuerID(String issuerID) Set a separate issuer idvoidsetLogOutPage(String logOutPage) Set the logout pagevoidsetSamlHandlerChainClass(String samlHandlerChainClass) Set the SAML Handler Chain Class fqnvoidsetSaveRestoreRequest(boolean saveRestoreRequest) Set whether the authenticator saves/restores the request during form authenticationvoidsetServiceURL(String serviceURL) Set the service URLvoidsetTimerInterval(String value) Set the Timer Value to reload the configurationprotected voidvoidprotected booleanvalidate(org.apache.catalina.connector.Request request) Perform validation os the request objectMethods inherited from class org.apache.catalina.authenticator.FormAuthenticator
doAuthenticate, forwardToErrorPage, forwardToLoginPage, getAuthMethod, getCharacterEncoding, getLandingPage, isContinuationRequired, matchRequest, register, restoreRequest, savedRequestURL, saveRequest, setCharacterEncoding, setLandingPageMethods inherited from class org.apache.catalina.authenticator.AuthenticatorBase
allowCorsPreflightBypass, associate, authenticate, changeSessionID, checkForCachedAuthentication, doLogin, getAllowCorsPreflight, getAlwaysUseSession, getCache, getChangeSessionIdOnAuthentication, getContainer, getDisableProxyCaching, getJaspicCallbackHandlerClass, getRealmName, getSecurePagesWithPragma, getSecureRandomAlgorithm, getSecureRandomClass, getSecureRandomProvider, invoke, isPreemptiveAuthPossible, isSendAuthInfoResponseHeaders, login, logout, notify, reauthenticateFromSSO, register, setAllowCorsPreflight, setAlwaysUseSession, setCache, setChangeSessionIdOnAuthentication, setContainer, setDisableProxyCaching, setJaspicCallbackHandlerClass, setSecurePagesWithPragma, setSecureRandomAlgorithm, setSecureRandomClass, setSecureRandomProvider, setSendAuthInfoResponseHeaders, startInternal, stopInternalMethods inherited from class org.apache.catalina.valves.ValveBase
backgroundProcess, getDomainInternal, getNext, getObjectNameKeyProperties, initInternal, isAsyncSupported, setAsyncSupported, setNext, toStringMethods inherited from class org.apache.catalina.util.LifecycleMBeanBase
destroyInternal, getDomain, getObjectName, postDeregister, postRegister, preDeregister, preRegister, register, setDomain, unregister, unregisterMethods inherited from class org.apache.catalina.util.LifecycleBase
addLifecycleListener, destroy, findLifecycleListeners, fireLifecycleEvent, getState, getStateName, getThrowOnFailure, init, removeLifecycleListener, setState, setState, setThrowOnFailure, start, stop
-
Field Details
-
logger
protected static final org.picketlink.common.PicketLinkLogger logger -
enableAudit
protected boolean enableAudit -
auditHelper
protected org.picketlink.identity.federation.core.audit.PicketLinkAuditHelper auditHelper -
keyManager
protected org.picketlink.identity.federation.core.interfaces.TrustKeyManager keyManager -
spConfiguration
protected org.picketlink.config.federation.SPType spConfiguration -
picketLinkConfiguration
protected org.picketlink.config.federation.PicketLinkType picketLinkConfiguration -
serviceURL
-
identityURL
-
issuerID
-
configFile
-
idpCertificate
If the service provider is configured with an IDP metadata file, then this certificate can be picked up from the metadata -
chain
protected transient org.picketlink.identity.federation.core.saml.v2.interfaces.SAML2HandlerChain chain -
samlHandlerChainClass
-
chainConfigOptions
-
saveRestoreRequest
protected boolean saveRestoreRequest -
chainLock
A Lock for Handler operations in the chain -
canonicalizationMethod
-
configProvider
protected org.picketlink.identity.federation.web.util.SAMLConfigurationProvider configProviderThe user can inject a fully qualified name of aSAMLConfigurationProvider -
timerInterval
protected int timerInterval -
timer
-
idpAddress
-
-
Constructor Details
-
BaseFormAuthenticator
public BaseFormAuthenticator()
-
-
Method Details
-
setIdpAddress
If the request.getRemoteAddr is not exactly the IDP address that you have keyed in your deployment descriptor for keystore alias, you can set it here explicitly- Parameters:
idpAddress- IP address of IDP
-
getConfigFile
Get the name of the configuration file- Returns:
- SAML config file path
-
setConfigFile
Set the name of the configuration file- Parameters:
configFile- set config file path
-
setSamlHandlerChainClass
Set the SAML Handler Chain Class fqn- Parameters:
samlHandlerChainClass- FQN of SAML Handler Chain
-
setServiceURL
Set the service URL- Parameters:
serviceURL- Service URL
-
setSaveRestoreRequest
public void setSaveRestoreRequest(boolean saveRestoreRequest) Set whether the authenticator saves/restores the request during form authentication- Parameters:
saveRestoreRequest- saves/restores the request during authentication if true
-
setConfigProvider
Set theSAMLConfigurationProviderfqn- Parameters:
cp- fqn of aSAMLConfigurationProvider
-
setConfigProvider
public void setConfigProvider(org.picketlink.identity.federation.web.util.SAMLConfigurationProvider configProvider) Set an instance of theSAMLConfigurationProvider- Parameters:
configProvider- SAML IDP/SP config provider
-
getConfiguration
public org.picketlink.config.federation.SPType getConfiguration()Get theSPType- Returns:
- SAML SP configuration
-
setIssuerID
Set a separate issuer id- Parameters:
issuerID- id of the issuer
-
setLogOutPage
Set the logout page- Parameters:
logOutPage- logout page URL
-
setTimerInterval
Set the Timer Value to reload the configuration- Parameters:
value- an integer value that represents timer value (in miliseconds)
-
validate
protected boolean validate(org.apache.catalina.connector.Request request) Perform validation os the request object- Parameters:
request- Apache Catalina Request- Returns:
- true if request contains a SAML Response parameter
-
getIdentityURL
Get the Identity URL- Returns:
- Identity URL
-
getIdpCertificate
Get theX509Certificateof the IDP if provided via the IDP metadata file- Returns:
X509Certificateor null
-
localAuthentication
protected boolean localAuthentication(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response, org.apache.tomcat.util.descriptor.web.LoginConfig loginConfig) throws IOException Fall back on local authentication at the service provider side- Parameters:
request- Apache Catalina Requestresponse- Apache Catalina ResponseloginConfig- Apache Catalina Login Config- Returns:
- true if authenticated
- Throws:
IOException- any I/O error during authentication
-
getBinding
Return the SAML Binding that this authenticator supports- Returns:
- supported SAML Binding
-
processIDPMetadataFile
Attempt to process a metadata file available locally- Parameters:
idpMetadataFile- path of configuration file of IDP Metadata
-
processConfiguration
protected void processConfiguration()Process the configuration from the configuration file -
handleMetadata
protected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType handleMetadata(org.picketlink.identity.federation.saml.v2.metadata.EntitiesDescriptorType entities) -
handleMetadata
protected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType handleMetadata(org.picketlink.identity.federation.saml.v2.metadata.EntityDescriptorType entityDescriptor) -
getIDPSSODescriptor
protected org.picketlink.identity.federation.saml.v2.metadata.IDPSSODescriptorType getIDPSSODescriptor(org.picketlink.identity.federation.saml.v2.metadata.EntitiesDescriptorType entities) -
initializeHandlerChain
protected void initializeHandlerChain() throws org.picketlink.common.exceptions.ConfigurationException, org.picketlink.common.exceptions.ProcessingException- Throws:
org.picketlink.common.exceptions.ConfigurationExceptionorg.picketlink.common.exceptions.ProcessingException
-
populateChainConfig
protected void populateChainConfig() throws org.picketlink.common.exceptions.ConfigurationException, org.picketlink.common.exceptions.ProcessingException- Throws:
org.picketlink.common.exceptions.ConfigurationExceptionorg.picketlink.common.exceptions.ProcessingException
-
sendToLogoutPage
protected void sendToLogoutPage(org.apache.catalina.connector.Request request, org.apache.catalina.connector.Response response, org.apache.catalina.Session session) throws IOException, javax.servlet.ServletException - Throws:
IOExceptionjavax.servlet.ServletException
-
testStart
public void testStart() throws org.apache.catalina.LifecycleException- Throws:
org.apache.catalina.LifecycleException
-
startPicketLink
protected void startPicketLink() throws org.apache.catalina.LifecycleException- Throws:
org.apache.catalina.LifecycleException
-
doSupportSignature
protected boolean doSupportSignature()Indicates if digital signatures/validation of SAML assertions are enabled. Subclasses that supports signature should override this method.
- Returns:
- true if SP Configuration supports signature
-
initKeyProvider
protected abstract void initKeyProvider(org.apache.catalina.Context context) throws org.apache.catalina.LifecycleException - Throws:
org.apache.catalina.LifecycleException
-
setAuditHelper
public void setAuditHelper(org.picketlink.identity.federation.core.audit.PicketLinkAuditHelper auditHelper)
-