SEC-162: Properly handle null Authentication.
This commit is contained in:
parent
c8c7c24822
commit
0c89822c56
|
@ -64,9 +64,6 @@ public class MethodInvocationPrivilegeEvaluator implements InitializingBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isAllowed(MethodInvocation mi, Authentication authentication) {
|
public boolean isAllowed(MethodInvocation mi, Authentication authentication) {
|
||||||
Assert.notNull(authentication, "Authentication required");
|
|
||||||
Assert.notNull(authentication.getAuthorities(),
|
|
||||||
"Authentication must provided non-null GrantedAuthority[]s");
|
|
||||||
Assert.notNull(mi, "MethodInvocation required");
|
Assert.notNull(mi, "MethodInvocation required");
|
||||||
Assert.notNull(mi.getMethod(),
|
Assert.notNull(mi.getMethod(),
|
||||||
"MethodInvocation must provide a non-null getMethod()");
|
"MethodInvocation must provide a non-null getMethod()");
|
||||||
|
@ -82,7 +79,7 @@ public class MethodInvocationPrivilegeEvaluator implements InitializingBean {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (authentication == null) {
|
if (authentication == null || authentication.getAuthorities() == null || authentication.getAuthorities().length == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue