I have an issue after upgrade spring boot and spring security authorization server to latest version by default spring security redirects to login page. I am using spring security OAuth2ResourceServer to authenticate my end points before upgrade my application login page only displayed if I hit the base url http://localhost:8080. I configured the below code in my application
@Bean public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception { LOGGER.info("Configuring web security..."); http .csrf(AbstractHttpConfigurer::disable) .logout(AbstractHttpConfigurer::disable) .headers(headers -> headers .frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin) .xssProtection(xXssConfig -> xXssConfig.headerValue( XXssProtectionHeaderWriter.HeaderValue.ENABLED_MODE_BLOCK)) .referrerPolicy(referrerPolicy -> referrerPolicy.policy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN)) .permissionsPolicy(permissionsPolicy -> permissionsPolicy.policy("geolocation=()"))); .oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()) .authorizeHttpRequests(authorizeHttpRequest -> authorizeHttpRequest. requestMatchers(new AntPathRequestMatcher("/api/**)).authenticated() .anyRequest().permitAll()); return build(http); }
Can you all give a suggestion to resolve this issue ?