You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason why the above configuration is not using your custom OpenSamlAuthenticationProvider is because you are configuring saml2Login() as well, which adds its own OpenSamlAuthenticationProvider.
The OpenSamlAuthenticationProvider configured by saml2Login() will process your request first, and therefore the request will not reach the custom OpenSamlAuthenticationProvider.
I have created a new issue gh-7654, to make it easier to set a custom OpenSamlAuthenticationProvider.
As a workaround for the moment, you can use an ObjectPostProcessor.
Here is an example of how it would work with the code you provided.
...
.saml2Login()
.addObjectPostProcessor(new ObjectPostProcessor<OpenSamlAuthenticationProvider>() {
public <O extends OpenSamlAuthenticationProvider> O postProcess(
O samlAuthProvider) {
samlAuthProvider.setAuthoritiesExtractor(authoritiesExtractor);
samlAuthProvider.setAuthoritiesMapper(authoritiesMapper);
return samlAuthProvider;
}
});
Summary
It doesn't appear possible to use
AuthenticationManagerBuilder
config withSaml2LoginConfigurer
to provide a custom Authority extractor.Actual Behavior
OpenSamlAuthenticationProvider
always uses the default implementation forauthoritiesExtractor
. See https://github.com/spring-projects/spring-security/blob/master/config/src/main/java/org/springframework/security/config/annotation/web/configurers/saml2/Saml2LoginConfigurer.java#L216-L219Expected Behavior
Use
AuthenticationManagerBuilder
to provideOpenSamlAuthenticationProvider
with a custom Authority mapper & extractor.Configuration
Version
Sample
https://github.com/mftruso/spring-security-saml-example/blob/master/src/main/java/com/miketruso/springsecurity/saml/demo/config/SecurityConfig.java
The text was updated successfully, but these errors were encountered: