Skip to content
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

Create HttpHeaders.setBasicAuth(String username, String password) [SPR-16913] #21452

Closed
spring-issuemaster opened this issue Jun 6, 2018 · 6 comments
Assignees
Milestone

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented Jun 6, 2018

Rob Winch opened SPR-16913 and commented

A disadvantage of the current WebClient HTTP Basic support is that you must have an ExchangeFilterFunction registered to process the client attribute. Since the support for HTTP Basic was added for WebClient the API has been modified the addition of RequestHeadersSpec.headers(Consumer<HttpHeaders>) has been added which would work very well for HTTP Basic support without the need for an ExchangeFilterFunction.

We should create a static method Consumer<HttpHeaders> httpBasic(String username, String password) that adds HTTP Basic authentication to the headers. This approach does not require an ExchangeFilterFunction to be registered for the header to be added to the request.

 


Issue Links:

  • #21535 Create HttpHeaders.setBearerAuth(String)
  • #21860 BasicAuthorizationInterceptor should add its header conditionally

Referenced from: commits e485abb, a663454, 6bcf6ff

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 2, 2018

Arjen Poutsma commented

This is now complete, see 6bcf6ff

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 2, 2018

Juergen Hoeller commented

I'm reopening this for reconsideration of where those methods should live. HttpHeaders itself is quite overloaded already and has no other such static methods, so I'd rather move them to a separate delegate...

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 2, 2018

Rob Winch commented

Thanks Arjen Poutsma and Juergen Hoeller. I wanted to call to attention that a similar request can be found in #21535

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 4, 2018

Juergen Hoeller commented

Assigning this to you, Rossen, for further consideration. Let's sort this out for 5.1 RC1, ideally in the next team call.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 5, 2018

Rossen Stoyanchev commented

After a discussion: let's turn this consumer into a setter on HttpHeaders and deprecate the basicAuth methods on ExchangeFilterFunctions.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jul 9, 2018

Arjen Poutsma commented

Done. See a663454

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.