use of org.springframework.security.saml.saml2.authentication.AuthenticationRequest in project service-authorization by reportportal.
the class NonAliasHostedServiceProviderService method authenticationRequest.
@Override
public AuthenticationRequest authenticationRequest(IdentityProviderMetadata idp) {
ExternalIdentityProviderConfiguration configuration = getIdentityProviderConfigurationForMetadata(idp);
final URI authnBinding = configuration.getAuthenticationRequestBinding();
Binding preferredBinding = authnBinding == null ? Binding.REDIRECT : Binding.fromUrn(authnBinding);
Endpoint endpoint = getPreferredEndpoint(idp.getIdentityProvider().getSingleSignOnService(), preferredBinding, 0);
ServiceProviderMetadata sp = getMetadata();
AuthenticationRequest request = new AuthenticationRequest().setId("ARQ" + UUID.randomUUID().toString().substring(1)).setIssueInstant(new DateTime(getClock().millis())).setForceAuth(Boolean.FALSE).setPassive(Boolean.FALSE).setBinding(endpoint.getBinding()).setAssertionConsumerService(getPreferredEndpoint(sp.getServiceProvider().getAssertionConsumerService(), null, -1)).setIssuer(new Issuer().setValue(sp.getEntityId())).setDestination(endpoint);
if (sp.getServiceProvider().isAuthnRequestsSigned()) {
request.setSigningKey(sp.getSigningKey(), sp.getAlgorithm(), sp.getDigest());
}
return authenticationRequestEnhancer.enhance(request);
}
Aggregations