use of org.opensaml.saml2.core.AuthnRequest in project cas by apereo.
the class SSOSamlIdPPostSimpleSignProfileHandlerControllerTests 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_SIMPLE_SIGN_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 SSOSamlIdPPostProfileHandlerControllerWithBrowserStorageTests 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 verify-hub by alphagov.
the class EntitiesDescriptorToElementTransformerTest method transform_shouldTransformASamlObjectIntoAnElement.
@Test
public void transform_shouldTransformASamlObjectIntoAnElement() {
AuthnRequest authnRequest = anAuthnRequest().withIssuer(anIssuer().build()).build();
XmlObjectToElementTransformer<AuthnRequest> transformer = new XmlObjectToElementTransformer<>();
Element result = transformer.apply(authnRequest);
assertThat(result).isNotNull();
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class HubTransformersFactoryTest method shouldNotContainKeyInfoInIdaAuthnRequest.
@Test
public void shouldNotContainKeyInfoInIdaAuthnRequest() throws Exception {
Function<IdaAuthnRequestFromHub, String> authnRequestTransformer = new HubTransformersFactory().getIdaAuthnRequestFromHubToStringTransformer(getKeyStore(hubSigningCert), signatureAlgorithm, digestAlgorithm);
IdaAuthnRequestFromHub idaAuthnRequestFromHub = IdaAuthnRequestBuilder.anIdaAuthnRequest().withLevelsOfAssurance(Collections.singletonList(AuthnContext.LEVEL_3)).buildFromHub();
String apply = authnRequestTransformer.apply(idaAuthnRequestFromHub);
assertThat(apply).isNotNull();
AuthnRequest authnReq = stringToOpenSamlObjectTransformer.apply(apply);
assertThat(authnReq).isNotNull();
assertThat(authnReq.getSignature()).isNotNull();
assertThat(authnReq.getSignature().getKeyInfo()).as("The Authn Request does not contain a KeyInfo section for Verify UK").isNull();
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class AuthnRequestFromRelyingPartyUnmarshallerTest method fromSamlMessage_shouldNotComplainWhenThereIsNoExtensionsElement.
@Test
public void fromSamlMessage_shouldNotComplainWhenThereIsNoExtensionsElement() throws Exception {
AuthnRequest authnRequest = new AuthnRequestBuilder().buildObject();
authnRequest.setIssuer(new IssuerBuilder().buildObject());
authnRequest.setDestination("http://example.com");
AuthnRequestFromRelyingParty authnRequestFromRelyingParty = unmarshaller.fromSamlMessage(authnRequest);
assertThat(authnRequestFromRelyingParty.getVerifyServiceProviderVersion()).isEqualTo(Optional.empty());
}
Aggregations