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;
}
Aggregations