-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
PermitAll doesn't work in security config #10587
Comments
Your Maybe you can modify the configuration to: http
.authorizeRequests()
.antMatchers("/v1/register").permitAll().and()
.authorizeRequests()
.antMatchers("/v1/**").authenticated().and().httpBasic();
|
Thanks for your answer, I tried to solve it this way, but it doesn't work.
But this is not proper way. |
If you use the command line to access your application, you may need to disable The configuration may be like this: http.csrf().disable()
.authorizeRequests()
.antMatchers("/v1/register").permitAll().and()
.authorizeRequests()
.antMatchers("/v1/**").authenticated().and().httpBasic(); |
Thanks for getting in touch, but it feels like this is a question that would be better suited to Stack Overflow. We prefer to use GitHub issues only for bugs and enhancements. Feel free to update this issue with a link to the re-posted question (so that other people can find it) or add a minimal sample that reproduces this issue if you feel this is a genuine bug. |
This will resolve the issue: main thing to include is .csrf().disable() http.authorizeRequests() |
So many pitfalls, I hope spring security would add a default config for REST APIs (token only) where csrf disabled by default, and session is disabled by default, and with built-in jwt/opaque token endpoint, and some BearerTokenFilter built-in, so on and so forth. with something like the following!
This would make life much easier in these days when every application is using react/angular/vue. |
Does anyone resolve this issue in proper way?? cuz the answers that i got from here , doesn' work for me... ( i got same issue now) |
Did you solve the issue? |
sosrry mate i don't remember |
I gave up on using So an example would be @Configuration
@EnableWebSecurity
public class SecurityConfig extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) {
web.ignoring().antMatchers("/**");
}
} (I'm also new so please correct me if I'm wrong) |
Hi all, I ran into the same issue lately. After lot of debugging, I could see that I had more One was coming from sprin-boot-actuator I excluded it, but then it came from
I did not dig more on why the condition is not respected, still I tried two things that worked:
In this case, my filter chain was picked up first and applied the necessary parameters. |
When I try to make request to opened endpoint /v1/register I get 401 Unauthorized or 403 Forbidden instead 2xx answer.
Code of security config with corresponding matchers
package net.neurosystems.mlapi.config;
pom xml
The question/bug is why are requests to endpoint /v1/register require authorization despite of permitAll instruction?
The text was updated successfully, but these errors were encountered: