use of java.security.AccessControlContext in project karaf by apache.
the class JaasHelper method currentUserHasRole.
public static boolean currentUserHasRole(String requestedRole) {
if (ROLE_WILDCARD.equals(requestedRole)) {
return true;
}
AccessControlContext acc = AccessController.getContext();
if (acc == null) {
return false;
}
Subject subject = Subject.getSubject(acc);
if (subject == null) {
return false;
}
return currentUserHasRole(subject.getPrincipals(), requestedRole);
}
Aggregations