use of org.forgerock.openam.entitlement.conditions.environment.SessionCondition in project OpenAM by OpenRock.
the class SessionConditionTest method setUp.
@BeforeMethod
public void setUp() {
Debug debug = mock(Debug.class);
coreWrapper = mock(CoreWrapper.class);
timeService = mock(TimeService.class);
condition = new SessionCondition(debug, coreWrapper, timeService);
}
use of org.forgerock.openam.entitlement.conditions.environment.SessionCondition in project OpenAM by OpenRock.
the class FactoryMethods method createArbitraryPrivilege.
public static Privilege createArbitraryPrivilege(String name, long now) throws EntitlementException {
Privilege privilege = Privilege.getNewInstance();
privilege.setName(name);
privilege.setDescription("Privilege " + name);
privilege.setCreatedBy("creatingAuthor");
privilege.setLastModifiedBy("modifyingAuthor");
privilege.setCreationDate(now);
privilege.setLastModifiedDate(now);
privilege.setActive(true);
privilege.setApplicationIndexes(asSet("arbitraryApplicationIndex"));
EntitlementCondition entitlementCondition = new SessionCondition();
entitlementCondition.setState("{ 'maxSessionTime': 10, 'terminateSession': true }");
privilege.setCondition(entitlementCondition);
// TODO: Define entitlement Subject
Set<ResourceAttribute> resourceAttributes = new HashSet<ResourceAttribute>();
// TODO: Define some ResourceAttributes
privilege.setResourceAttributes(resourceAttributes);
Entitlement entitlement = new Entitlement();
entitlement.setName("arbitraryEntitlementName");
entitlement.setResourceName("http://www.artibrary.com/resource");
Map<String, Boolean> actionValues = new HashMap<String, Boolean>();
actionValues.put("arbitraryAction", true);
entitlement.setActionValues(actionValues);
privilege.setEntitlement(entitlement);
return privilege;
}
Aggregations