use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.
the class ProxyPETest method createAuthenticatedUsersSubject.
private Subject createAuthenticatedUsersSubject(PolicyManager pm) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AuthenticatedUsers");
return subject;
}
use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.
the class MetaDataTest method createSubject.
private Subject createSubject(PolicyManager pm) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AMIdentitySubject");
Set<String> set = new HashSet<String>();
set.add(testUser.getUniversalId());
subject.setValues(set);
return subject;
}
use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.
the class PolicyIndexTest method createSubject.
private Subject createSubject(PolicyManager pm) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AMIdentitySubject");
Set<String> set = new HashSet<String>();
set.add("testgroup");
subject.setValues(set);
return subject;
}
use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.
the class PolicyEvaluatorTest method createGroupSubject.
private Subject createGroupSubject(PolicyManager pm) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AMIdentitySubject");
Set<String> set = new HashSet<String>();
set.add(testGroup.getUniversalId());
subject.setValues(set);
return subject;
}
use of com.sun.identity.policy.interfaces.Subject in project OpenAM by OpenRock.
the class UpgradeUtils method createPolicyAdminPolicy.
/**
* Creates Policy Admin Policy.
*
* @param policyManager the policy manager object.
* @param orgDN the organization dn.
* @param orgID the organization identifier.
*/
private static void createPolicyAdminPolicy(PolicyManager policyManager, String orgDN, String orgID) {
String classMethod = "UpgradeUtils:createRealmReadOnlyPolicy";
try {
String policyName = orgID + "^^PolicyAdmin";
Policy realmPolicy = new Policy(policyName, null, false, true);
// create Rule
String resourceName = "sms://*" + orgDN + "/" + POLICY_SERVICE;
Rule rule = getRule(DELEGATION_SERVICE, resourceName);
if (rule != null) {
realmPolicy.addRule(rule);
}
// add subjects
String policyAdminRoleUniversalID = getUniversalID(orgDN, ORG_POLICY_ADMIN_ROLE);
Subject subject = getSubject(policyManager, policyAdminRoleUniversalID);
if (subject != null) {
realmPolicy.addSubject(DELEGATION_SUBJECT, subject, false);
}
policyManager.addPolicy(realmPolicy);
} catch (Exception e) {
debug.error(classMethod + "Error creating policy admin policy", e);
}
}
Aggregations