Search in sources :

Example 41 with Subject

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;
}
Also used : Subject(com.sun.identity.policy.interfaces.Subject)

Example 42 with 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;
}
Also used : Subject(com.sun.identity.policy.interfaces.Subject) HashSet(java.util.HashSet)

Example 43 with 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;
}
Also used : Subject(com.sun.identity.policy.interfaces.Subject) HashSet(java.util.HashSet)

Example 44 with 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;
}
Also used : Subject(com.sun.identity.policy.interfaces.Subject) HashSet(java.util.HashSet)

Example 45 with 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);
    }
}
Also used : Policy(com.sun.identity.policy.Policy) ByteString(org.forgerock.opendj.ldap.ByteString) Rule(com.sun.identity.policy.Rule) Subject(com.sun.identity.policy.interfaces.Subject) LoginException(javax.security.auth.login.LoginException) InvalidAuthContextException(com.sun.identity.authentication.internal.InvalidAuthContextException) UnknownPropertyNameException(com.sun.identity.common.configuration.UnknownPropertyNameException) PolicyException(com.sun.identity.policy.PolicyException) FileNotFoundException(java.io.FileNotFoundException) SSOException(com.iplanet.sso.SSOException) LdapException(org.forgerock.opendj.ldap.LdapException) SMSException(com.sun.identity.sm.SMSException) IOException(java.io.IOException) AMException(com.iplanet.am.sdk.AMException) ConfigurationException(com.sun.identity.common.configuration.ConfigurationException)

Aggregations

Subject (com.sun.identity.policy.interfaces.Subject)47 HashSet (java.util.HashSet)18 PolicyException (com.sun.identity.policy.PolicyException)17 SSOException (com.iplanet.sso.SSOException)14 Policy (com.sun.identity.policy.Policy)14 Set (java.util.Set)12 AMConsoleException (com.sun.identity.console.base.model.AMConsoleException)11 NameNotFoundException (com.sun.identity.policy.NameNotFoundException)11 SubjectTypeManager (com.sun.identity.policy.SubjectTypeManager)11 EntitlementSubject (com.sun.identity.entitlement.EntitlementSubject)8 Rule (com.sun.identity.policy.Rule)8 Iterator (java.util.Iterator)8 PolicyManager (com.sun.identity.policy.PolicyManager)7 CachedPolicy (com.sun.identity.console.policy.model.CachedPolicy)6 AMException (com.iplanet.am.sdk.AMException)5 InvalidAuthContextException (com.sun.identity.authentication.internal.InvalidAuthContextException)5 ConfigurationException (com.sun.identity.common.configuration.ConfigurationException)5 UnknownPropertyNameException (com.sun.identity.common.configuration.UnknownPropertyNameException)5 SMSException (com.sun.identity.sm.SMSException)5 FileNotFoundException (java.io.FileNotFoundException)5