Add AuthenticationTrustResolver.isAuthenticated
This commit is contained in:
committed by
Marcus Hert Da Coregio
parent
3093908a6e
commit
750cb30ce4
+1
-1
@@ -52,7 +52,7 @@ public class ExceptionTranslationWebFilter implements WebFilter {
|
||||
return chain.filter(exchange)
|
||||
.onErrorResume(AccessDeniedException.class, (denied) -> exchange.getPrincipal()
|
||||
.filter((principal) -> (!(principal instanceof Authentication) || (principal instanceof Authentication
|
||||
&& !(this.authenticationTrustResolver.isAnonymous((Authentication) principal)))))
|
||||
&& (this.authenticationTrustResolver.isAuthenticated((Authentication) principal)))))
|
||||
.switchIfEmpty(commenceAuthentication(exchange,
|
||||
new InsufficientAuthenticationException(
|
||||
"Full authentication is required to access this resource")))
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public class SecurityContextHolderAwareRequestWrapper extends HttpServletRequest
|
||||
*/
|
||||
private Authentication getAuthentication() {
|
||||
Authentication auth = this.securityContextHolderStrategy.getContext().getAuthentication();
|
||||
return (!this.trustResolver.isAnonymous(auth)) ? auth : null;
|
||||
return (this.trustResolver.isAuthenticated(auth)) ? auth : null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ public class SessionManagementFilter extends GenericFilterBean {
|
||||
request.setAttribute(FILTER_APPLIED, Boolean.TRUE);
|
||||
if (!this.securityContextRepository.containsContext(request)) {
|
||||
Authentication authentication = this.securityContextHolderStrategy.getContext().getAuthentication();
|
||||
if (authentication != null && !this.trustResolver.isAnonymous(authentication)) {
|
||||
if (this.trustResolver.isAuthenticated(authentication)) {
|
||||
// The user has been authenticated during the current request, so call the
|
||||
// session strategy
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user