Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Bean
- protected SecurityFilterChain filterChain(final HttpSecurity http) throws Exception {
- http.cors()
- .and()
- .csrf()
- .disable()
- .authorizeRequests()
- .antMatchers(SECURITY_WHITELIST)
- .permitAll()
- .anyRequest()
- .authenticated()
- .and()
- .httpBasic()
- .and()
- .exceptionHandling()
- .authenticationEntryPoint(authenticationEntryPoint).and().sessionManagement()
- .sessionCreationPolicy(SessionCreationPolicy.STATELESS);
- http.addFilterBefore(tokenAuthorizationFilter, UsernamePasswordAuthenticationFilter.class);
- return http.build();
- }
- @Bean
- protected SecurityFilterChain samlFilterChain(final HttpSecurity http) throws Exception {
- OpenSamlAuthenticationProvider authenticationProvider = new OpenSamlAuthenticationProvider();
- authenticationProvider.setResponseAuthenticationConverter(groupsConverter());
- http.csrf().disable() //todo !! check
- .authorizeHttpRequests(authorize -> authorize
- .antMatchers(DEFAULT_OKTA_URL)
- .permitAll()
- .anyRequest().authenticated()
- )
- .saml2Login(saml2 -> saml2
- .authenticationManager(new ProviderManager(authenticationProvider))
- )
- .saml2Login()
- .successHandler(successRedirectHandler())
- .failureHandler(failureRedirectHandler())
- .and()
- .saml2Logout(Customizer.withDefaults());
- return http.build();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement