-
Notifications
You must be signed in to change notification settings - Fork 312
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All requests to /graphql always result in 401 unauthorized status (Spring boot 3.0.0 and WebMvc) #576
Comments
I have the same issue, this may be related to this |
I was staring a new project using spring boot 3.0.0 and was getting the same issue when protecting all endpoints and using JWT with AWS Cognito @Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
return http
.csrf(CsrfConfigurer::disable)
.authorizeHttpRequests(auth -> auth
.anyRequest().authenticated())
.securityContext(context -> context.requireExplicitSave(false)) // <<<---------
.oauth2ResourceServer(OAuth2ResourceServerConfigurer::jwt)
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
.build();
}
} What solved the issue for me, at least for now (keep in mind this is a brand new project), was to add this line: .securityContext(context -> context.requireExplicitSave(false)) I'm not sure yet why it worked setting this to Here is my repo with the project example. |
Had the same issue, and upgraded to 3.0.1 to fix it. I think it's fixed in 3.0.1. |
Awesome, just tested here upgrading to 3.0.1 and it worked like a charm. Thanks @m-thirumal for the tip 🙌 |
Proof example app with details in README.md: https://github.com/ohapegor/spring-graphql-security-bug
The text was updated successfully, but these errors were encountered: