class AuthLevelCondition extends EntitlementConditionAdaptor {

    @Override
    public ConditionDecision evaluate(String realm, Subject subject, String resourceName, Map<String, Set<String>> env)
            throws EntitlementException {

        if (subject == null) {
            return new ConditionDecision(false, Collections.<String, Set<String>>emptyMap());
        }
        
        if (authLevel == null) {
            throw new EntitlementException(PROPERTY_VALUE_NOT_DEFINED, new String[]{AUTH_LEVEL}, null);
        }

        boolean allowed = false;
        Map<String, Set<String>> advices = new HashMap<String, Set<String>>();
        if (debug.messageEnabled()) {
            debug.message(getConditionName() + ".getConditionDecision():entering");
        }

        try {
            int maxRequestAuthLevel = getMaxRequestAuthLevel(env);
            if (maxRequestAuthLevel == Integer.MIN_VALUE) {
                SSOToken token = (SSOToken) subject.getPrivateCredentials().iterator().next();
                maxRequestAuthLevel = getMaxRequestAuthLevel(token);
            }

            allowed = isAllowed(maxRequestAuthLevel, advices);

            if (debug.messageEnabled()) {
                debug.message("At " + getConditionName() + ".getConditionDecision():authLevel=" + authLevel
                        + ",maxRequestAuthLevel=" + maxRequestAuthLevel + ",allowed = " + allowed);
            }
        } catch (SSOException e) {
            if (debug.messageEnabled()) {
                debug.message("Problem getting auth level from SSOToken: " + e.getMessage(), e);
            }
        }
        return new ConditionDecision(allowed, advices);
    }

    public  AuthLevelCondition();
      AuthLevelCondition(Debug debug, CoreWrapper coreWrapper);

}