From a60a6c0157a7413445a635160eb2360bfe96a6d6 Mon Sep 17 00:00:00 2001 From: haynescd Date: Mon, 22 Jan 2024 11:56:54 -0500 Subject: [PATCH] :bug: fix SAML2 Config --- .../security/config/Saml2SecurityConfig.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/cbioportal/security/config/Saml2SecurityConfig.java b/src/main/java/org/cbioportal/security/config/Saml2SecurityConfig.java index a95743b4385..c6fbe732fa5 100644 --- a/src/main/java/org/cbioportal/security/config/Saml2SecurityConfig.java +++ b/src/main/java/org/cbioportal/security/config/Saml2SecurityConfig.java @@ -7,7 +7,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; import org.springframework.http.HttpStatus; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; @@ -41,13 +40,6 @@ public class Saml2SecurityConfig { @Autowired(required = false) private RelyingPartyRegistrationRepository relyingPartyRegistrationRepository; - @Autowired - public void configure(AuthenticationManagerBuilder builder) { - OpenSaml4AuthenticationProvider saml4AuthenticationProvider = new OpenSaml4AuthenticationProvider(); - saml4AuthenticationProvider.setResponseAuthenticationConverter(rolesConverter()); - builder.authenticationProvider(saml4AuthenticationProvider); - } - @Bean public SecurityFilterChain samlFilterChain(HttpSecurity http) throws Exception { return http @@ -72,6 +64,13 @@ public SecurityFilterChain samlFilterChain(HttpSecurity http) throws Exception { .build(); } + @Bean + public OpenSaml4AuthenticationProvider openSaml4AuthenticationProvider() { + OpenSaml4AuthenticationProvider authenticationProvider = new OpenSaml4AuthenticationProvider(); + authenticationProvider.setResponseAuthenticationConverter(rolesConverter()); + return authenticationProvider; + } + private Converter rolesConverter() { Converter delegate =