52: UsernamePasswordAuthenticationToken result = new UsernamePasswordAuthenticationToken(userDetails, authentication.getCredentials(), authentication.getAuthorities());
53: result.setAuthenticated(authentication.isAuthenticated());
a call of result.setAuthenticated(true) raises an exception:
public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException {
if (isAuthenticated) {
throw new IllegalArgumentException(
"Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead");
}
super.setAuthenticated(false);
}
the whole call of setAuthenticated is unnecessary as the property gets set directly within the constructor of UsernamePasswordAuthenticationToken.
So please remove the line that tries to set the authenticated property, otherwise it is not possible to use a UsernamePasswordAuthenticationToken which has authenticated set to true.
In AuthenticationProviderProxyFactory Line 53:
a call of result.setAuthenticated(true) raises an exception:
the whole call of setAuthenticated is unnecessary as the property gets set directly within the constructor of UsernamePasswordAuthenticationToken.
So please remove the line that tries to set the authenticated property, otherwise it is not possible to use a UsernamePasswordAuthenticationToken which has authenticated set to true.