Polish Optional usage
This commit is contained in:
parent
ffed4ea1dc
commit
e76de931ce
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -395,9 +395,9 @@ public final class ServletOAuth2AuthorizedClientExchangeFilterFunction implement
|
||||||
}
|
}
|
||||||
|
|
||||||
private Mono<ClientRequest> mergeRequestAttributesIfNecessary(ClientRequest request) {
|
private Mono<ClientRequest> mergeRequestAttributesIfNecessary(ClientRequest request) {
|
||||||
if (!request.attribute(HTTP_SERVLET_REQUEST_ATTR_NAME).isPresent()
|
if (request.attribute(HTTP_SERVLET_REQUEST_ATTR_NAME).isEmpty()
|
||||||
|| !request.attribute(HTTP_SERVLET_RESPONSE_ATTR_NAME).isPresent()
|
|| request.attribute(HTTP_SERVLET_RESPONSE_ATTR_NAME).isEmpty()
|
||||||
|| !request.attribute(AUTHENTICATION_ATTR_NAME).isPresent()) {
|
|| request.attribute(AUTHENTICATION_ATTR_NAME).isEmpty()) {
|
||||||
return mergeRequestAttributesFromContext(request);
|
return mergeRequestAttributesFromContext(request);
|
||||||
}
|
}
|
||||||
return Mono.just(request);
|
return Mono.just(request);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2022 the original author or authors.
|
* Copyright 2002-2024 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -228,7 +228,7 @@ public class SwitchUserWebFilter implements WebFilter {
|
||||||
@NonNull
|
@NonNull
|
||||||
private Authentication attemptExitUser(Authentication currentAuthentication) {
|
private Authentication attemptExitUser(Authentication currentAuthentication) {
|
||||||
Optional<Authentication> sourceAuthentication = extractSourceAuthentication(currentAuthentication);
|
Optional<Authentication> sourceAuthentication = extractSourceAuthentication(currentAuthentication);
|
||||||
if (!sourceAuthentication.isPresent()) {
|
if (sourceAuthentication.isEmpty()) {
|
||||||
this.logger.debug("Failed to find original user");
|
this.logger.debug("Failed to find original user");
|
||||||
throw noOriginalAuthenticationException();
|
throw noOriginalAuthenticationException();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue