Skip to content

Allow configuring SecurityContextRepository for BasicAuthenticationFilter #12031

Closed
@rwinch

Description

@rwinch

We should allow configuring SecurityContextRepository on BasicAuthenticationFilter so that users do not need to rely on SecurityContextPersistenceFitler. Users that want BasicAuthenticationFilter to use a custom repository right now can do this:

http
	.httpBasic(b -> b.addObjectPostProcessor(new ObjectPostProcessor<BasicAuthenticationFilter>() {
			@Override
			public <O extends BasicAuthenticationFilter> O postProcess(O filter) {
				filter.setSecurityContextRepository(new HttpSessionSecurityContextRepository());
				return filter;
			}
		}));

However, it should be easier to configure with an explicit option.

Metadata

Metadata

Assignees

Labels

in: configAn issue in spring-security-configtype: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions