* @return Boolean.TRUE if the active user has the specified role
*/
@Override
public Boolean get(Object role) {
AuthenticationStatus authStatus = _activeUser.getAuthenticationStatus();
RoleSet authRoles = _activeUser.getAuthenticationStatus().getAuthenticatedRoles();
if ((role != null) && (role instanceof String)) {
String sRole = Val.chkStr((String)role);
boolean bAnonymous = !authStatus.getWasAuthenticated();
if (sRole.equalsIgnoreCase("anonymous")) {
return new Boolean(bAnonymous);
} else if (!bAnonymous) {
if (sRole.equalsIgnoreCase("openid")) {
return Val.chkStr(_activeUser.getKey()).startsWith("urn:openid:");
} else {
RoleSet rs = new RoleSet();
rs.addDelimited(sRole);
return new Boolean(authRoles.hasRole(rs));
}
}
}
return Boolean.FALSE;