Search in sources :

Example 1 with Binding

use of org.springframework.security.saml.saml2.metadata.Binding 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);
}
Also used : Binding(org.springframework.security.saml.saml2.metadata.Binding) ServiceProviderMetadata(org.springframework.security.saml.saml2.metadata.ServiceProviderMetadata) Endpoint(org.springframework.security.saml.saml2.metadata.Endpoint) Issuer(org.springframework.security.saml.saml2.authentication.Issuer) AuthenticationRequest(org.springframework.security.saml.saml2.authentication.AuthenticationRequest) URI(java.net.URI) DateTime(org.joda.time.DateTime) ExternalIdentityProviderConfiguration(org.springframework.security.saml.provider.service.config.ExternalIdentityProviderConfiguration)

Aggregations

URI (java.net.URI)1 DateTime (org.joda.time.DateTime)1 ExternalIdentityProviderConfiguration (org.springframework.security.saml.provider.service.config.ExternalIdentityProviderConfiguration)1 AuthenticationRequest (org.springframework.security.saml.saml2.authentication.AuthenticationRequest)1 Issuer (org.springframework.security.saml.saml2.authentication.Issuer)1 Binding (org.springframework.security.saml.saml2.metadata.Binding)1 Endpoint (org.springframework.security.saml.saml2.metadata.Endpoint)1 ServiceProviderMetadata (org.springframework.security.saml.saml2.metadata.ServiceProviderMetadata)1