class JaasUtils {

    public static boolean hasPrincipal(final Class<? extends Principal> principalClass) {
        if (principalClass == null)
            throw new IllegalArgumentException("Principal class cannot be null.");

        return !getCurrentSubject().getPrincipals(principalClass).isEmpty();
    }

}