Search in sources :

Example 1 with SessionCondition

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);
}
Also used : CoreWrapper(org.forgerock.openam.core.CoreWrapper) TimeService(org.forgerock.util.time.TimeService) SessionCondition(org.forgerock.openam.entitlement.conditions.environment.SessionCondition) Debug(com.sun.identity.shared.debug.Debug) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 2 with SessionCondition

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;
}
Also used : EntitlementCondition(com.sun.identity.entitlement.EntitlementCondition) HashMap(java.util.HashMap) ReferralPrivilege(com.sun.identity.entitlement.ReferralPrivilege) Privilege(com.sun.identity.entitlement.Privilege) SessionCondition(org.forgerock.openam.entitlement.conditions.environment.SessionCondition) ResourceAttribute(com.sun.identity.entitlement.ResourceAttribute) Entitlement(com.sun.identity.entitlement.Entitlement) HashSet(java.util.HashSet)

Aggregations

SessionCondition (org.forgerock.openam.entitlement.conditions.environment.SessionCondition)2 Entitlement (com.sun.identity.entitlement.Entitlement)1 EntitlementCondition (com.sun.identity.entitlement.EntitlementCondition)1 Privilege (com.sun.identity.entitlement.Privilege)1 ReferralPrivilege (com.sun.identity.entitlement.ReferralPrivilege)1 ResourceAttribute (com.sun.identity.entitlement.ResourceAttribute)1 Debug (com.sun.identity.shared.debug.Debug)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 CoreWrapper (org.forgerock.openam.core.CoreWrapper)1 TimeService (org.forgerock.util.time.TimeService)1 BeforeMethod (org.testng.annotations.BeforeMethod)1