Skip to content

Spring Security Configuraion Issue : Permit All Not working #14011

@dv0892

Description

@dv0892

I am configuring a bean of type SecurityFilterChain in a very simple spring boot application with jsp .

URI's like / or /welcome should be accessible by anyone

But URI /authenticate or any other request should require authentication

Here is Security Config

@Bean
	public SecurityFilterChain filterChain( HttpSecurity http , MvcRequestMatcher.Builder mvc) throws Exception {		
            http.csrf(AbstractHttpConfigurer::disable)
		.authorizeHttpRequests(auth -> 
			auth.requestMatchers(mvc.pattern("/"),mvc.pattern("/welcome")).permitAll()
			.anyRequest().authenticated()
			)
		.formLogin(Customizer.withDefaults())
		.httpBasic(Customizer.withDefaults());

		return http.build();
	}

But it is asking me to login to every URI pattern including / and /welcome.

I have attached my sample repository on which I am facing this issue
https://github.com/dv0892/Security-Sample/tree/master

Seems like permitAll() is not working.
Please let me know if anything else is required

Metadata

Metadata

Labels

in: configAn issue in spring-security-configstatus: invalidAn issue that we don't feel is validtype: bugA general bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions