Search in sources :

Example 1 with InMemoryRelyingPartyRegistrationRepository

use of org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository in project midpoint by Evolveum.

the class SamlModuleWebSecurityConfiguration method buildInternal.

private static SamlModuleWebSecurityConfiguration buildInternal(Saml2AuthenticationModuleType modelType, String prefixOfSequence, String publicHttpUrlPattern, ServletRequest request) {
    SamlModuleWebSecurityConfiguration configuration = new SamlModuleWebSecurityConfiguration();
    build(configuration, modelType, prefixOfSequence);
    List<Saml2ServiceProviderAuthenticationModuleType> serviceProviders = modelType.getServiceProvider();
    List<RelyingPartyRegistration> registrations = new ArrayList<>();
    serviceProviders.forEach(serviceProviderType -> {
        Saml2KeyAuthenticationModuleType keysType = serviceProviderType.getKeys();
        Saml2ProviderAuthenticationModuleType providerType = serviceProviderType.getIdentityProvider();
        RelyingPartyRegistration.Builder registrationBuilder = getRelyingPartyFromMetadata(providerType.getMetadata(), providerType);
        SamlAdditionalConfiguration.Builder additionalConfigBuilder = SamlAdditionalConfiguration.builder();
        createRelyingPartyRegistration(registrationBuilder, additionalConfigBuilder, providerType, publicHttpUrlPattern, configuration, keysType, serviceProviderType, request);
        RelyingPartyRegistration registration = registrationBuilder.build();
        registrations.add(registration);
        configuration.additionalConfiguration.put(registration.getRegistrationId(), additionalConfigBuilder.build());
    });
    InMemoryRelyingPartyRegistrationRepository relyingPartyRegistrationRepository = new InMemoryRelyingPartyRegistrationRepository(registrations);
    configuration.setRelyingPartyRegistrationRepository(relyingPartyRegistrationRepository);
    return configuration;
}
Also used : RelyingPartyRegistration(org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration) ArrayList(java.util.ArrayList) InMemoryRelyingPartyRegistrationRepository(org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository)

Aggregations

ArrayList (java.util.ArrayList)1 InMemoryRelyingPartyRegistrationRepository (org.springframework.security.saml2.provider.service.registration.InMemoryRelyingPartyRegistrationRepository)1 RelyingPartyRegistration (org.springframework.security.saml2.provider.service.registration.RelyingPartyRegistration)1