Skip to content

Configure WebSecurity without WebSecurityConfigurerAdapter #8978

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

Closed
eleftherias opened this issue Aug 21, 2020 · 1 comment · Fixed by #8998
Closed

Configure WebSecurity without WebSecurityConfigurerAdapter #8978

eleftherias opened this issue Aug 21, 2020 · 1 comment · Fixed by #8998
Assignees
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Milestone

Comments

@eleftherias
Copy link
Contributor

Expected Behavior

We should be able to configure WebSecurity without needing WebSecurityConfigurerAdapter.

The approach is to create a customizer for WebSecurity and expose that as a bean.

Current Behavior

The WebSecurityConfigurerAdapter has the ability to customize WebSecurity.
Here is an example:

@Configuration
static class WebConfigurer extends WebSecurityConfigurerAdapter {
	@Override
	public void configure(WebSecurity web) {
		web
			.ignoring()
				.antMatchers("/ignore1", "/ignore2");
	}
}

Related: gh-8804

@eleftherias eleftherias added in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement labels Aug 21, 2020
@eleftherias eleftherias self-assigned this Aug 21, 2020
eleftherias added a commit to eleftherias/spring-security that referenced this issue Sep 7, 2020
eleftherias added a commit that referenced this issue Sep 9, 2020
@eleftherias
Copy link
Contributor Author

WebSecurity can now be configured by exposing a WebSecurityCustomizer bean.

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
	return (web) -> web.ignoring().antMatchers("/ignore1", "/ignore2");
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: web An issue in web modules (web, webmvc) type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant