SEC-999: Fix broken test which was failing due to use of incorrect authentication object.

This commit is contained in:
Luke Taylor 2008-11-05 01:09:14 +00:00
parent 56141e9c5f
commit a207acf7cb
1 changed files with 8 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.Set;
import org.springframework.security.Authentication;
import org.springframework.security.AuthenticationTrustResolver;
import org.springframework.security.GrantedAuthority;
import org.springframework.security.util.AuthorityUtils;
/**
@ -41,7 +42,13 @@ public class SecurityExpressionRoot {
}
public final boolean hasRole(String role) {
return AuthorityUtils.userHasAuthority(role);
for (GrantedAuthority authority : authentication.getAuthorities()) {
if (role.equals(authority.getAuthority())) {
return true;
}
}
return false;
}
public final boolean hasAnyRole(String... roles) {