use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class SSOSamlIdPPostProfileHandlerControllerWithTicketRegistryTests method getAuthnRequest.
private AuthnRequest getAuthnRequest() {
var builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
val authnRequest = (AuthnRequest) builder.buildObject();
authnRequest.setProtocolBinding(SAMLConstants.SAML2_POST_BINDING_URI);
builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
val issuer = (Issuer) builder.buildObject();
issuer.setValue(samlRegisteredService.getServiceId());
authnRequest.setIssuer(issuer);
return authnRequest;
}
use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class SSOSamlIdPProfileCallbackHandlerControllerWithBrowserStorageTests method getAuthnRequest.
private AuthnRequest getAuthnRequest() {
var builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
var authnRequest = (AuthnRequest) builder.buildObject();
builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
val issuer = (Issuer) builder.buildObject();
issuer.setValue(samlRegisteredService.getServiceId());
authnRequest.setIssuer(issuer);
return authnRequest;
}
use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class SSOSamlIdPProfileCallbackHandlerControllerTests method getAuthnRequest.
private AuthnRequest getAuthnRequest() {
var builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
var authnRequest = (AuthnRequest) builder.buildObject();
builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
val issuer = (Issuer) builder.buildObject();
issuer.setValue(samlRegisteredService.getServiceId());
authnRequest.setIssuer(issuer);
return authnRequest;
}
use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class SamlIdPTestUtils method getAuthnRequest.
/**
* Gets authn request.
*
* @param openSamlConfigBean the open saml config bean
* @param samlRegisteredService the saml registered service
* @return the authn request
*/
public static AuthnRequest getAuthnRequest(final OpenSamlConfigBean openSamlConfigBean, final SamlRegisteredService samlRegisteredService) {
var builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(AuthnRequest.DEFAULT_ELEMENT_NAME);
var authnRequest = (AuthnRequest) Objects.requireNonNull(builder).buildObject();
builder = (SAMLObjectBuilder) openSamlConfigBean.getBuilderFactory().getBuilder(Issuer.DEFAULT_ELEMENT_NAME);
val issuer = (Issuer) Objects.requireNonNull(builder).buildObject();
issuer.setValue(samlRegisteredService.getServiceId());
authnRequest.setIssuer(issuer);
return authnRequest;
}
use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class AbstractSamlIdPProfileHandlerController method constructServiceUrl.
/**
* Construct service url string.
*
* @param request the request
* @param response the response
* @param pair the pair
* @return the string
* @throws Exception the exception
*/
protected String constructServiceUrl(final HttpServletRequest request, final HttpServletResponse response, final Pair<? extends SignableSAMLObject, MessageContext> pair) throws Exception {
val authnRequest = (AuthnRequest) pair.getLeft();
val builder = new URLBuilder(configurationContext.getCallbackService().getId());
builder.getQueryParams().add(new net.shibboleth.utilities.java.support.collection.Pair<>(SamlProtocolConstants.PARAMETER_ENTITY_ID, SamlIdPUtils.getIssuerFromSamlObject(authnRequest)));
storeAuthenticationRequest(request, response, pair);
val url = builder.buildURL();
LOGGER.trace("Built service callback url [{}]", url);
return CommonUtils.constructServiceUrl(request, response, url, configurationContext.getCasProperties().getServer().getName(), CasProtocolConstants.PARAMETER_SERVICE, CasProtocolConstants.PARAMETER_TICKET, false);
}
Aggregations