SEC-162: Properly handle null Authentication.

This commit is contained in:
Ben Alex 2006-01-28 01:24:52 +00:00
parent c8c7c24822
commit 0c89822c56
1 changed files with 1 additions and 4 deletions

View File

@ -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;
} }