Class AbstractSamlProfileHandlerController
- java.lang.Object
-
- org.apereo.cas.support.saml.web.idp.profile.AbstractSamlProfileHandlerController
-
- Direct Known Subclasses:
AbstractSamlSLOProfileHandlerController,ECPProfileHandlerController,IdentityProviderInitiatedProfileHandlerController,Saml1ArtifactResolutionProfileHandlerController,Saml2AttributeQueryProfileHandlerController,SSOSamlPostProfileHandlerController,SSOSamlPostSimpleSignProfileHandlerController,SSOSamlProfileCallbackHandlerController
@Controller public abstract class AbstractSamlProfileHandlerController extends java.lang.ObjectA parent controller to handle SAML requests. Specific profile endpoints are handled by extensions. This parent provides the necessary ops for profile endpoint controllers to respond to end points.- Since:
- 5.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected SamlProfileHandlerConfigurationContextsamlProfileHandlerConfigurationContextSAML profile configuration context.
-
Constructor Summary
Constructors Constructor Description AbstractSamlProfileHandlerController()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.jasig.cas.client.validation.AssertionbuildCasAssertion(java.lang.String principal, org.apereo.cas.services.RegisteredService registeredService, java.util.Map<java.lang.String,java.lang.Object> attributes)Build cas assertion.protected org.jasig.cas.client.validation.AssertionbuildCasAssertion(org.apereo.cas.authentication.Authentication authentication, org.apereo.cas.authentication.principal.Service service, org.apereo.cas.services.RegisteredService registeredService, java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributesToCombine)Build cas assertion.protected java.lang.StringbuildRedirectUrlByRequestedAuthnContext(java.lang.String initialUrl, org.opensaml.saml.saml2.core.AuthnRequest authnRequest, javax.servlet.http.HttpServletRequest request)Build redirect url by requested authn context.protected voidbuildSamlResponse(javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, org.apache.commons.lang3.tuple.Pair<org.opensaml.saml.saml2.core.AuthnRequest,org.opensaml.messaging.context.MessageContext> authenticationContext, org.jasig.cas.client.validation.Assertion casAssertion, java.lang.String binding)Build saml response.protected java.lang.StringconstructServiceUrl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair)Construct service url string.protected org.opensaml.messaging.context.MessageContextdecodeSoapRequest(javax.servlet.http.HttpServletRequest request)Decode soap 11 context.protected java.util.Map<java.lang.String,java.lang.String>getAuthenticationContextMappings()Gets authentication context mappings.protected org.apache.commons.lang3.tuple.Pair<org.apereo.cas.support.saml.services.SamlRegisteredService,org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade>getRegisteredServiceAndFacade(org.opensaml.saml.saml2.core.AuthnRequest request)Gets registered service and facade.protected java.util.Optional<org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade>getSamlMetadataFacadeFor(org.apereo.cas.support.saml.services.SamlRegisteredService registeredService, java.lang.String entityId)Gets saml metadata adaptor for service.protected java.util.Optional<org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade>getSamlMetadataFacadeFor(org.apereo.cas.support.saml.services.SamlRegisteredService registeredService, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest)Gets saml metadata adaptor for service.org.springframework.web.servlet.ModelAndViewhandleUnauthorizedServiceException(javax.servlet.http.HttpServletRequest req, java.lang.Exception ex)Handle unauthorized service exception.protected voidinitiateAuthenticationRequest(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request)Initiate authentication request.protected voidissueAuthenticationRequestRedirect(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)Redirect request for authentication.protected voidlogCasValidationAssertion(org.jasig.cas.client.validation.Assertion assertion)Log cas validation assertion.protected org.opensaml.saml.saml2.core.AuthnRequestretrieveSamlAuthenticationRequestFromHttpRequest(javax.servlet.http.HttpServletRequest request)Retrieve authn request authn request.protected voidverifyAuthenticationContextSignature(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> authenticationContext, javax.servlet.http.HttpServletRequest request, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest, org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade adaptor)Verify authentication context signature.protected voidverifyAuthenticationContextSignature(org.opensaml.messaging.context.MessageContext ctx, javax.servlet.http.HttpServletRequest request, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest, org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade adaptor)Verify authentication context signature.protected org.apache.commons.lang3.tuple.Pair<org.apereo.cas.support.saml.services.SamlRegisteredService,org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade>verifySamlAuthenticationRequest(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> authenticationContext, javax.servlet.http.HttpServletRequest request)Verify saml authentication request.protected org.apereo.cas.support.saml.services.SamlRegisteredServiceverifySamlRegisteredService(java.lang.String serviceId)Gets registered service and verify.
-
-
-
Field Detail
-
samlProfileHandlerConfigurationContext
protected final SamlProfileHandlerConfigurationContext samlProfileHandlerConfigurationContext
SAML profile configuration context.
-
-
Method Detail
-
getSamlMetadataFacadeFor
protected java.util.Optional<org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade> getSamlMetadataFacadeFor(org.apereo.cas.support.saml.services.SamlRegisteredService registeredService, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest)Gets saml metadata adaptor for service.- Parameters:
registeredService- the registered serviceauthnRequest- the authn request- Returns:
- the saml metadata adaptor for service
-
getSamlMetadataFacadeFor
protected java.util.Optional<org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade> getSamlMetadataFacadeFor(org.apereo.cas.support.saml.services.SamlRegisteredService registeredService, java.lang.String entityId)Gets saml metadata adaptor for service.- Parameters:
registeredService- the registered serviceentityId- the entity id- Returns:
- the saml metadata adaptor for service
-
verifySamlRegisteredService
protected org.apereo.cas.support.saml.services.SamlRegisteredService verifySamlRegisteredService(java.lang.String serviceId)
Gets registered service and verify.- Parameters:
serviceId- the service id- Returns:
- the registered service and verify
-
retrieveSamlAuthenticationRequestFromHttpRequest
protected org.opensaml.saml.saml2.core.AuthnRequest retrieveSamlAuthenticationRequestFromHttpRequest(javax.servlet.http.HttpServletRequest request) throws java.lang.ExceptionRetrieve authn request authn request.- Parameters:
request- the request- Returns:
- the authn request
- Throws:
java.lang.Exception- the exception
-
buildCasAssertion
protected org.jasig.cas.client.validation.Assertion buildCasAssertion(org.apereo.cas.authentication.Authentication authentication, org.apereo.cas.authentication.principal.Service service, org.apereo.cas.services.RegisteredService registeredService, java.util.Map<java.lang.String,java.util.List<java.lang.Object>> attributesToCombine)Build cas assertion.- Parameters:
authentication- the authenticationservice- the serviceregisteredService- the registered serviceattributesToCombine- the attributes to combine- Returns:
- the assertion
-
buildCasAssertion
protected org.jasig.cas.client.validation.Assertion buildCasAssertion(java.lang.String principal, org.apereo.cas.services.RegisteredService registeredService, java.util.Map<java.lang.String,java.lang.Object> attributes)Build cas assertion.- Parameters:
principal- the principalregisteredService- the registered serviceattributes- the attributes- Returns:
- the assertion
-
logCasValidationAssertion
protected void logCasValidationAssertion(org.jasig.cas.client.validation.Assertion assertion)
Log cas validation assertion.- Parameters:
assertion- the assertion
-
issueAuthenticationRequestRedirect
protected void issueAuthenticationRequestRedirect(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.lang.ExceptionRedirect request for authentication.- Parameters:
pair- the pairrequest- the requestresponse- the response- Throws:
java.lang.Exception- the exception
-
getAuthenticationContextMappings
protected java.util.Map<java.lang.String,java.lang.String> getAuthenticationContextMappings()
Gets authentication context mappings.- Returns:
- the authentication context mappings
-
buildRedirectUrlByRequestedAuthnContext
protected java.lang.String buildRedirectUrlByRequestedAuthnContext(java.lang.String initialUrl, org.opensaml.saml.saml2.core.AuthnRequest authnRequest, javax.servlet.http.HttpServletRequest request)Build redirect url by requested authn context.- Parameters:
initialUrl- the initial urlauthnRequest- the authn requestrequest- the request- Returns:
- the redirect url
-
constructServiceUrl
protected java.lang.String constructServiceUrl(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair) throws org.apereo.cas.support.saml.SamlExceptionConstruct service url string.- Parameters:
request- the requestresponse- the responsepair- the pair- Returns:
- the string
- Throws:
org.apereo.cas.support.saml.SamlException- the saml exception
-
initiateAuthenticationRequest
protected void initiateAuthenticationRequest(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> pair, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request) throws java.lang.ExceptionInitiate authentication request.- Parameters:
pair- the pairresponse- the responserequest- the request- Throws:
java.lang.Exception- the exception
-
verifySamlAuthenticationRequest
protected org.apache.commons.lang3.tuple.Pair<org.apereo.cas.support.saml.services.SamlRegisteredService,org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade> verifySamlAuthenticationRequest(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> authenticationContext, javax.servlet.http.HttpServletRequest request) throws java.lang.ExceptionVerify saml authentication request.- Parameters:
authenticationContext- the pairrequest- the request- Returns:
- the pair
- Throws:
java.lang.Exception- the exception
-
verifyAuthenticationContextSignature
protected void verifyAuthenticationContextSignature(org.apache.commons.lang3.tuple.Pair<? extends org.opensaml.saml.common.SignableSAMLObject,org.opensaml.messaging.context.MessageContext> authenticationContext, javax.servlet.http.HttpServletRequest request, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest, org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws java.lang.ExceptionVerify authentication context signature.- Parameters:
authenticationContext- the authentication contextrequest- the requestauthnRequest- the authn requestadaptor- the adaptor- Throws:
java.lang.Exception- the exception
-
verifyAuthenticationContextSignature
protected void verifyAuthenticationContextSignature(org.opensaml.messaging.context.MessageContext ctx, javax.servlet.http.HttpServletRequest request, org.opensaml.saml.saml2.core.RequestAbstractType authnRequest, org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade adaptor) throws java.lang.ExceptionVerify authentication context signature.- Parameters:
ctx- the authentication contextrequest- the requestauthnRequest- the authn requestadaptor- the adaptor- Throws:
java.lang.Exception- the exception
-
buildSamlResponse
protected void buildSamlResponse(javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request, org.apache.commons.lang3.tuple.Pair<org.opensaml.saml.saml2.core.AuthnRequest,org.opensaml.messaging.context.MessageContext> authenticationContext, org.jasig.cas.client.validation.Assertion casAssertion, java.lang.String binding)Build saml response.- Parameters:
response- the responserequest- the requestauthenticationContext- the authentication contextcasAssertion- the cas assertionbinding- the binding
-
getRegisteredServiceAndFacade
protected org.apache.commons.lang3.tuple.Pair<org.apereo.cas.support.saml.services.SamlRegisteredService,org.apereo.cas.support.saml.services.idp.metadata.SamlRegisteredServiceServiceProviderMetadataFacade> getRegisteredServiceAndFacade(org.opensaml.saml.saml2.core.AuthnRequest request)
Gets registered service and facade.- Parameters:
request- the request- Returns:
- the registered service and facade
-
decodeSoapRequest
protected org.opensaml.messaging.context.MessageContext decodeSoapRequest(javax.servlet.http.HttpServletRequest request)
Decode soap 11 context.- Parameters:
request- the request- Returns:
- the soap 11 context
-
handleUnauthorizedServiceException
@ExceptionHandler(org.apereo.cas.services.UnauthorizedServiceException.class) public org.springframework.web.servlet.ModelAndView handleUnauthorizedServiceException(javax.servlet.http.HttpServletRequest req, java.lang.Exception ex)Handle unauthorized service exception.- Parameters:
req- the reqex- the ex- Returns:
- the model and view
-
-