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);
}
}
}
}
Aggregations