Skip to content

Allow http basic auth to be configured using nested builder #6885

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 May 16, 2019 · 3 comments · Fixed by #6901
Closed

Allow http basic auth to be configured using nested builder #6885

eleftherias opened this issue May 16, 2019 · 3 comments · Fixed by #6901
Assignees
Labels
in: config An issue in spring-security-config
Milestone

Comments

@eleftherias
Copy link
Contributor

Support nested builder

Currently HTTP basic authentication can be configured in the following way.

http
	.httpBasic()
	.realmName("Realm");

We should allow configuration using a nested builder, as follows.

http
	.httpBasic(httpBasicConfig -> httpBasicConfig.realmName("Realm"));

The remaining methods should also be available in the nested builder, authenticationEntryPoint, authenticationDetailsSource.

Remove need for and()

Any subsequent configurations to HttpSecurity will not need to be chained using and().

http
	.httpBasic(httpBasicConfig -> httpBasicConfig.realmName("Realm"))
	.cors();

Nest disable()

HTTP basic authentication should be disabled using a nested builder as well

http
    .httpBasic(HttpBasicConfigurer::disable);

note: HttpBasicConfigurer may not be the appropriate class name.

@eleftherias eleftherias self-assigned this May 16, 2019
@eleftherias eleftherias added the in: config An issue in spring-security-config label May 16, 2019
@rwinch
Copy link
Member

rwinch commented May 17, 2019

To keep things simple I'd say we should hold off on httpBasic(HttpBasicConfigurer::disable) since users will be able to do httpBasic(httpBasicConfig -> httpBasicConfig.disable()).

@eleftherias
Copy link
Contributor Author

@rwinch I believe those are equivalent (assuming that we continue to use the HttpBasicConfigurer). The IDE will actually prompt you to replace the lambda with the method reference.

@rwinch
Copy link
Member

rwinch commented May 20, 2019

Oops. My mistake. You are right :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: config An issue in spring-security-config
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants