Search in sources :

Example 1 with SamlService

use of org.apereo.cas.support.saml.authentication.principal.SamlService in project cas by apereo.

the class AbstractSamlObjectBuilder method setInResponseToForSamlResponseIfNeeded.

/**
     * Sets in response to for saml response.
     *
     * @param service      the service
     * @param samlResponse the saml response
     */
public static void setInResponseToForSamlResponseIfNeeded(final Service service, final SignableSAMLObject samlResponse) {
    if (service instanceof SamlService) {
        final SamlService samlService = (SamlService) service;
        final String requestId = samlService.getRequestID();
        if (StringUtils.isNotBlank(requestId)) {
            if (samlResponse instanceof org.opensaml.saml.saml1.core.Response) {
                ((org.opensaml.saml.saml1.core.Response) samlResponse).setInResponseTo(requestId);
            }
            if (samlResponse instanceof org.opensaml.saml.saml2.core.Response) {
                ((org.opensaml.saml.saml2.core.Response) samlResponse).setInResponseTo(requestId);
            }
        }
    }
}
Also used : SamlService(org.apereo.cas.support.saml.authentication.principal.SamlService) XSString(org.opensaml.core.xml.schema.XSString)

Aggregations

SamlService (org.apereo.cas.support.saml.authentication.principal.SamlService)1 XSString (org.opensaml.core.xml.schema.XSString)1