Skip to content
Snippets Groups Projects
Commit d3c7d79f authored by Nicholas Blair's avatar Nicholas Blair
Browse files

Removed unnecessary log noise, added logging to matchesRequiredGrantedAuthority

Noise was copied from Spring Security SwitchUserFilter, not relevant to this use case, as it applies to every request, not just a special login attempt.
parent 79a2a700
No related branches found
No related tags found
No related merge requests found
......@@ -302,13 +302,16 @@ public class SwitchUserOnHeaderFilter extends GenericFilterBean {
* {@link GrantedAuthority#getAuthority()} equals {@link #getRequiredGrantedAuthority()}.
*/
protected boolean matchesRequiredGrantedAuthority(Authentication authentication) {
if(authentication == null || CollectionUtils.isEmpty(authentication.getAuthorities())) return false;
for(GrantedAuthority authority : authentication.getAuthorities()) {
if(authority.getAuthority().equals(getRequiredGrantedAuthority())) {
return true;
boolean result = false;
if(authentication != null) {
for (GrantedAuthority authority : authentication.getAuthorities()) {
if (authority.getAuthority().equals(getRequiredGrantedAuthority())) {
result = true;
}
}
}
return false;
logger.debug("matchesGrantedAuthority for authentication {}, looking for {}, returning {}", authentication, getRequiredGrantedAuthority(), result);
return result;
}
/**
......@@ -326,7 +329,6 @@ public class SwitchUserOnHeaderFilter extends GenericFilterBean {
}
return result;
}
logger.warn("detected request attempting to use switch user header {} by authentication {}", getSwitchUserHeaderName(), authentication);
return false;
}
/**
......@@ -344,7 +346,6 @@ public class SwitchUserOnHeaderFilter extends GenericFilterBean {
}
return result;
}
logger.warn("detected request attempting to use switch exit header {} by authentication {}", getSwitchExitHeaderName(), authentication);
return false;
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment