use of com.sun.identity.entitlement.opensso.OpenSSOUserSubject in project OpenAM by OpenRock.
the class ApplicationDelegationTest method createPrivileges.
private void createPrivileges() throws EntitlementException {
PrivilegeManager pm = PrivilegeManager.getInstance("/", adminSubject);
Map<String, Boolean> actionValues = new HashMap<String, Boolean>();
actionValues.put("GET", Boolean.TRUE);
Entitlement entitlement = new Entitlement(APPL_NAME, DELEGATED_RESOURCE_BASE, actionValues);
OpenSSOUserSubject subject = new OpenSSOUserSubject("id=dummy,ou=user," + SMSEntry.getRootSuffix());
Privilege privilege1 = Privilege.getNewInstance();
privilege1.setName(PRIVILEGE_NAME1);
privilege1.setEntitlement(entitlement);
privilege1.setSubject(subject);
pm.add(privilege1);
Privilege privilege2 = Privilege.getNewInstance();
privilege2.setName(PRIVILEGE_NAME2);
entitlement.setResourceName(DELEGATED_RESOURCE);
privilege2.setEntitlement(entitlement);
privilege2.setSubject(subject);
pm.add(privilege2);
}
use of com.sun.identity.entitlement.opensso.OpenSSOUserSubject in project OpenAM by OpenRock.
the class ApplicationFilterTest method createDelegationPrivilege.
private void createDelegationPrivilege() throws SMSException, EntitlementException, SSOException, IdRepoException, InterruptedException {
ApplicationPrivilege ap = new ApplicationPrivilege(DELEGATE_PRIVILEGE_NAME);
OpenSSOUserSubject sbj = new OpenSSOUserSubject();
sbj.setID(user1.getUniversalId());
Set<SubjectImplementation> subjects = new HashSet<SubjectImplementation>();
subjects.add(sbj);
ap.setSubject(subjects);
Map<String, Set<String>> appRes = new HashMap<String, Set<String>>();
Set<String> res = new HashSet<String>();
appRes.put(APPL_NAME, res);
res.add(DELEGATED_RESOURCE_BASE);
ap.setApplicationResources(appRes);
ap.setActionValues(ApplicationPrivilege.PossibleAction.READ);
ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
apm.addPrivilege(ap);
}
use of com.sun.identity.entitlement.opensso.OpenSSOUserSubject in project OpenAM by OpenRock.
the class ApplicationPrivilegeMetaTest method createDelegationPrivilege.
private void createDelegationPrivilege() throws SMSException, EntitlementException, SSOException, IdRepoException, InterruptedException {
ApplicationPrivilege ap = new ApplicationPrivilege(DELEGATE_PRIVILEGE_NAME);
OpenSSOUserSubject sbj = new OpenSSOUserSubject();
sbj.setID("id=dummy,dc=openam,dc=forgerock,dc=org");
Set<SubjectImplementation> subjects = new HashSet<SubjectImplementation>();
subjects.add(sbj);
ap.setSubject(subjects);
Map<String, Set<String>> appRes = new HashMap<String, Set<String>>();
Set<String> res = new HashSet<String>();
appRes.put(APPL_NAME, res);
res.add(DELEGATED_RESOURCE);
ap.setApplicationResources(appRes);
ap.setActionValues(ApplicationPrivilege.PossibleAction.READ);
ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
apm.addPrivilege(ap);
}
use of com.sun.identity.entitlement.opensso.OpenSSOUserSubject in project OpenAM by OpenRock.
the class ApplicationDelegationTest method createDelegationPrivilege.
private void createDelegationPrivilege() throws SMSException, EntitlementException, SSOException, IdRepoException, InterruptedException {
ApplicationPrivilege ap = new ApplicationPrivilege(DELEGATE_PRIVILEGE_NAME);
OpenSSOUserSubject sbj = new OpenSSOUserSubject();
sbj.setID(user1.getUniversalId());
Set<SubjectImplementation> subjects = new HashSet<SubjectImplementation>();
subjects.add(sbj);
ap.setSubject(subjects);
Map<String, Set<String>> appRes = new HashMap<String, Set<String>>();
Set<String> res = new HashSet<String>();
appRes.put(APPL_NAME, res);
res.add(DELEGATED_RESOURCE);
ap.setApplicationResources(appRes);
ap.setActionValues(ApplicationPrivilege.PossibleAction.READ);
ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance("/", adminSubject);
apm.addPrivilege(ap);
}
use of com.sun.identity.entitlement.opensso.OpenSSOUserSubject in project OpenAM by OpenRock.
the class PrivilegeDelegationTest method createApplicationPrivilege.
private ApplicationPrivilegeManager createApplicationPrivilege(ApplicationPrivilege.PossibleAction actions) throws EntitlementException {
ApplicationPrivilegeManager apm = ApplicationPrivilegeManager.getInstance(realm, SubjectUtils.createSubject(adminToken));
ApplicationPrivilege ap = new ApplicationPrivilege(DELEG_PRIVILEGE_NAME);
OpenSSOUserSubject sbj = new OpenSSOUserSubject();
sbj.setID(user.getUniversalId());
Set<SubjectImplementation> subjects = new HashSet<SubjectImplementation>();
subjects.add(sbj);
ap.setSubject(subjects);
Set<String> res = new HashSet<String>();
Map<String, Set<String>> appRes = new HashMap<String, Set<String>>();
appRes.put(ApplicationTypeManager.URL_APPLICATION_TYPE_NAME, res);
res.add(RESOURCE + "/*");
ap.setApplicationResources(appRes);
ap.setActionValues(actions);
apm.addPrivilege(ap);
return apm;
}
Aggregations