Evaluator.java revision fb3b3a01405c222ae1fdbbe6f5c1d4aa696195bb
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2008 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: Evaluator.java,v 1.2 2009/09/10 16:35:38 veiming Exp $
*
* Portions copyright 2013-2014 ForgeRock AS.
*/
/**
* The class evaluates entitlement request and provides decisions.
* @supported.api
*/
public class Evaluator {
private Subject adminSubject;
private String applicationName =
public static final int DEFAULT_POLICY_EVAL_THREAD = 10;
private final PolicyMonitor policyMonitor;
private final EntitlementConfigurationWrapper configWrapper;
/**
* Constructor to create an evaluator of default service type.
*
* @throws EntitlementException if any other abnormal condition occ.
*/
private Evaluator()
throws EntitlementException {
}
/**
* Constructor to create an evaluator given the service type.
*
* @param subject Subject who credential is used for performing the
* evaluation.
* @param applicationName the name of the aplication for
* which this evaluator can be used.
* @throws EntitlementException if any other abnormal condition occured.
*/
throws EntitlementException {
this.applicationName = applicationName;
}
/**
* Constructor to create an evaluator the default service type.
*
* @param subject Subject who credential is used for performing the
* evaluation.
* @throws EntitlementException if any other abnormal condition occured.
*/
throws EntitlementException {
}
/**
* Returns <code>true</code> if the subject is granted to an
* entitlement.
*
* @param realm Realm name.
* @param subject Subject who is under evaluation.
* @param e Entitlement object which describes the resource name and
* actions.
* @param envParameters Map of environment parameters.
* @return <code>true</code> if the subject is granted to an
* entitlement.
* @throws EntitlementException if the result cannot be determined.
*/
public boolean hasEntitlement(
Entitlement e,
) throws EntitlementException {
return result;
}
/**
* Returns a list of entitlements for a given subject, resource names
* and environment.
*
* @param realm Realm Name.
* @param subject Subject who is under evaluation.
* @param resourceNames Resource names.
* @param environment Environment parameters.
* @return a list of entitlements for a given subject, resource name
* and environment.
* @throws EntitlementException if the result cannot be determined.
*/
) throws EntitlementException {
throw new EntitlementException(424);
}
false);
}
}
return results;
}
/**
* Returns a list of entitlements for a given subject, resource name
* and environment.
*
* @param realm
* Realm Name.
* @param subject
* Subject who is under evaluation.
* @param resourceName
* Resource name.
* @param environment
* Environment parameters.
* @param recursive
* <code>true</code> to perform evaluation on sub resources
* from the given resource name.
* @return a list of entitlements for a given subject, resource name
* and environment.
* @throws EntitlementException
* if the result cannot be determined.
*/
boolean recursive
) throws EntitlementException {
if (application == null) {
// App retrieval error.
}
// Normalise the incoming resource URL.
if (configWrapper.isMonitoringRunning()) {
policyMonitor.addEvaluation(System.currentTimeMillis() - startTime, realm, applicationName, resourceName,
}
return results;
}
/**
* Returns application name.
*
* @return application name.
*/
public String getApplicationName() {
return applicationName;
}
}