public class SAMLContextProviderImpl extends Object implements SAMLContextProvider, org.springframework.beans.factory.InitializingBean
Modifier and Type | Field and Description |
---|---|
protected KeyManager |
keyManager |
protected static org.slf4j.Logger |
log |
protected MetadataManager |
metadata |
protected org.opensaml.security.MetadataCredentialResolver |
metadataResolver |
protected org.opensaml.xml.security.x509.PKIXValidationInformationResolver |
pkixResolver |
protected org.opensaml.xml.security.x509.PKIXTrustEvaluator |
pkixTrustEvaluator |
protected SAMLMessageStorageFactory |
storageFactory |
Constructor and Description |
---|
SAMLContextProviderImpl() |
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Verifies that required entities were autowired or set and initializes resolvers used to construct trust engines.
|
protected String |
getDefaultLocalEntityId(SAMLMessageContext context,
String requestURI)
Returns localEntityId to be populated for the context in case alias is missing from the path
|
protected QName |
getDefaultLocalEntityRole(SAMLMessageContext context,
String requestURI)
Returns localEntityRole to be populated for the context in case alias is missing from the path
|
SAMLMessageContext |
getLocalAndPeerEntity(HttpServletRequest request,
HttpServletResponse response)
Creates a SAMLContext with local entity and peer values filled.
|
SAMLMessageContext |
getLocalEntity(HttpServletRequest request,
HttpServletResponse response)
Creates a SAMLContext with local entity values filled.
|
protected void |
populateDecrypter(SAMLMessageContext samlContext)
Populates a decrypter based on settings in the extended metadata or using a default credential when no
encryption credential is specified in the extended metadata.
|
protected void |
populateGenericContext(HttpServletRequest request,
HttpServletResponse response,
SAMLMessageContext context) |
protected void |
populateLocalContext(SAMLMessageContext context) |
protected void |
populateLocalEntity(SAMLMessageContext samlContext)
Method populates fields localEntityId, localEntityRole, localEntityMetadata, localEntityRoleMetadata and peerEntityRole.
|
protected void |
populateLocalEntityId(SAMLMessageContext context,
String requestURI)
Method tries to load localEntityAlias and localEntityRole from the request path.
|
protected void |
populatePeerContext(SAMLMessageContext samlContext)
Populates additional information about the peer based on the previously loaded peerEntityId.
|
protected void |
populatePeerEntityId(SAMLMessageContext context)
First tries to find pre-configured IDP from the request attribute.
|
protected void |
populatePeerSSLCredential(SAMLMessageContext samlContext)
Tries to load peer SSL certificate from the inbound message transport using attribute
"javax.servlet.request.X509Certificate".
|
protected void |
populateSSLCredential(SAMLMessageContext samlContext)
Populates X509 Credential used to authenticate this machine against peer servers.
|
protected void |
populateSSLHostnameVerifier(SAMLMessageContext samlContext)
Populates hostname verifier using value configured in the context provider..
|
protected void |
populateSSLTrustEngine(SAMLMessageContext samlContext)
Based on the settings in the extended metadata either creates a PKIX trust engine with trusted keys specified
in the extended metadata as anchors or (by default) an explicit trust engine using data from the metadata or
from the values overridden in the ExtendedMetadata.
|
protected void |
populateTrustEngine(SAMLMessageContext samlContext)
Based on the settings in the extended metadata either creates a PKIX trust engine with trusted keys specified
in the extended metadata as anchors or (by default) an explicit trust engine using data from the metadata or
from the values overridden in the ExtendedMetadata.
|
void |
setKeyManager(KeyManager keyManager)
Key manager provides information about private certificate and trusted keys provide in addition to
cryptographic material present in entity metadata documents.
|
void |
setMetadata(MetadataManager metadata)
Metadata manager provides information about all available IDP and SP entities.
|
void |
setMetadataResolver(org.opensaml.security.MetadataCredentialResolver metadataResolver)
Sets resolver used to populate trusted credentials from XML and Extended metadata.
|
void |
setPkixResolver(org.opensaml.xml.security.x509.PKIXValidationInformationResolver pkixResolver)
Sets resolver used to populate data for PKIX trust engine.
|
void |
setPkixTrustEvaluator(org.opensaml.xml.security.x509.PKIXTrustEvaluator pkixTrustEvaluator)
Trust evaluator is responsible for verifying whether to trust certificate based on PKIX verification.
|
void |
setStorageFactory(SAMLMessageStorageFactory storageFactory)
Implementation of the SAML message storage factory providing custom mechanism for storage
of SAML messages such as http session, cookies or no storage at all.
|
protected static final org.slf4j.Logger log
protected KeyManager keyManager
protected MetadataManager metadata
protected org.opensaml.security.MetadataCredentialResolver metadataResolver
protected org.opensaml.xml.security.x509.PKIXValidationInformationResolver pkixResolver
protected org.opensaml.xml.security.x509.PKIXTrustEvaluator pkixTrustEvaluator
protected SAMLMessageStorageFactory storageFactory
public SAMLMessageContext getLocalEntity(HttpServletRequest request, HttpServletResponse response) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
getLocalEntity
in interface SAMLContextProvider
request
- requestresponse
- responseorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case of metadata problemspublic SAMLMessageContext getLocalAndPeerEntity(HttpServletRequest request, HttpServletResponse response) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
getLocalAndPeerEntity
in interface SAMLContextProvider
request
- requestresponse
- responseorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case of metadata problemsprotected void populatePeerEntityId(SAMLMessageContext context) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
If request parameter is null the default IDP is returned.
context
- context to populate ID fororg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case provided IDP value is invalidprotected void populatePeerContext(SAMLMessageContext samlContext) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
samlContext
- to populateorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case metadata problem is encounteredprotected void populateGenericContext(HttpServletRequest request, HttpServletResponse response, SAMLMessageContext context) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
org.opensaml.saml2.metadata.provider.MetadataProviderException
protected void populateLocalContext(SAMLMessageContext context) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
org.opensaml.saml2.metadata.provider.MetadataProviderException
protected void populateLocalEntityId(SAMLMessageContext context, String requestURI) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
In case alias entity id isn't found an exception is raised.
context
- context to populate fields localEntityId and localEntityRole forrequestURI
- context path to parse entityId and entityRole fromorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case entityId can't be populatedprotected String getDefaultLocalEntityId(SAMLMessageContext context, String requestURI) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
context
- context to retrieve localEntityId forrequestURI
- context path to parse entityId fromorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case entityId can't be retrievedprotected QName getDefaultLocalEntityRole(SAMLMessageContext context, String requestURI) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
context
- context to retrieve localEntityRole forrequestURI
- context path to parse entityRole fromorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case entityRole can't be retrievedprotected void populateLocalEntity(SAMLMessageContext samlContext) throws org.opensaml.saml2.metadata.provider.MetadataProviderException
samlContext
- context to populateorg.opensaml.saml2.metadata.provider.MetadataProviderException
- in case metadata do not contain expected entities or localAlias is specified but not foundprotected void populateSSLCredential(SAMLMessageContext samlContext)
samlContext
- context to populateprotected void populateSSLHostnameVerifier(SAMLMessageContext samlContext)
samlContext
- context to populateprotected void populatePeerSSLCredential(SAMLMessageContext samlContext)
samlContext
- context to populateprotected void populateDecrypter(SAMLMessageContext samlContext)
samlContext
- context to populate decryptor for.protected void populateTrustEngine(SAMLMessageContext samlContext)
samlContext
- context to populateprotected void populateSSLTrustEngine(SAMLMessageContext samlContext)
samlContext
- context to populate@Autowired public void setMetadata(MetadataManager metadata)
metadata
- metadata mangaer@Autowired public void setKeyManager(KeyManager keyManager)
keyManager
- key managerpublic void setPkixResolver(org.opensaml.xml.security.x509.PKIXValidationInformationResolver pkixResolver)
pkixResolver
- pkix resolverPKIXInformationResolver
public void setPkixTrustEvaluator(org.opensaml.xml.security.x509.PKIXTrustEvaluator pkixTrustEvaluator)
pkixTrustEvaluator
- pkix trust evaluatorCertPathPKIXTrustEvaluator
public void setMetadataResolver(org.opensaml.security.MetadataCredentialResolver metadataResolver)
metadataResolver
- metaiop resolverMetadataCredentialResolver
@Autowired(required=false) public void setStorageFactory(SAMLMessageStorageFactory storageFactory)
storageFactory
- storage factorypublic void afterPropertiesSet() throws ServletException
afterPropertiesSet
in interface org.springframework.beans.factory.InitializingBean
ServletException