BasicAuthenticationInterceptor with HttpHeaders.setBasicAuth alignment

Issue: SPR-17326
This commit is contained in:
Juergen Hoeller
2018-10-09 23:13:46 +02:00
parent c8c0737ce7
commit 2b986af310
4 changed files with 101 additions and 12 deletions

View File

@@ -115,11 +115,9 @@ public abstract class ExchangeFilterFunctions {
*/
@Deprecated
public static ExchangeFilterFunction basicAuthentication() {
return (request, next) -> {
Credentials cred = (Credentials) request
.attribute(BASIC_AUTHENTICATION_CREDENTIALS_ATTRIBUTE).orElse(null);
if (cred != null) {
return next.exchange(ClientRequest.from(request)
.headers(headers -> headers.setBasicAuth(cred.username, cred.password))