use of com.sun.identity.policy.SubjectTypeManager in project OpenAM by OpenRock.
the class PrivilegePolicyMapping 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.SubjectTypeManager in project OpenAM by OpenRock.
the class Util method createAMIdentitySubject.
/**
* Returns a Subject for the given AMIdentity.
* @param pm The PolicyManager to use.
* @param user The user to convert into a Subject
* @return a Subject for the given AMIdentity.
* @throws PolicyException if there was a problem creating the Subject.
*/
public static Subject createAMIdentitySubject(PolicyManager pm, AMIdentity user) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AMIdentitySubject");
Set<String> set = new HashSet<String>();
set.add(user.getUniversalId());
subject.setValues(set);
return subject;
}
use of com.sun.identity.policy.SubjectTypeManager in project OpenAM by OpenRock.
the class Util method createAuthenticatedUsersSubject.
/**
* Returns A Subject that represents all authenticated users.
* @param pm The PolicyManager to use.
* @return A Subject that represents all authenticated users.
* @throws PolicyException if there was a problem creating the Subject.
*/
public static Subject createAuthenticatedUsersSubject(PolicyManager pm) throws PolicyException {
SubjectTypeManager mgr = pm.getSubjectTypeManager();
Subject subject = mgr.getSubject("AuthenticatedUsers");
return subject;
}
use of com.sun.identity.policy.SubjectTypeManager in project OpenAM by OpenRock.
the class UpgradeUtils method getSubject.
/**
* Returns the policy <code>Subject</code>
*
*/
private static Subject getSubject(PolicyManager policyManager, String universalID) {
String classMethod = "UpgradeUtils:getSubject : ";
Subject subject = null;
try {
SubjectTypeManager stm = policyManager.getSubjectTypeManager();
subject = stm.getSubject(AM_ID_SUBJECT);
Set subjectValues = new HashSet(1);
subjectValues.add(universalID);
subject.setValues(subjectValues);
} catch (Exception e) {
debug.error(classMethod + "Error creating subject", e);
}
return subject;
}
use of com.sun.identity.policy.SubjectTypeManager in project OpenAM by OpenRock.
the class PolicyModelImpl method getSubjectPossibleValues.
/**
* Returns a set of possible values for a subject type.
*
* @param realmName Name of Realm.
* @param subjectType Name of Subject Type.
* @param filter wildcards for filtering the results.
* @return a set of possible values for a subject type.
* @throws AMConsoleException if values cannot be obtained.
*/
public ValidValues getSubjectPossibleValues(String realmName, String subjectType, String filter) throws AMConsoleException {
debug.error("PolicyModelImpl.getSubjectPossibleValues()");
ValidValues values = null;
if ((filter == null) || (filter.trim().length() == 0)) {
filter = "*";
}
try {
PolicyManager policyMgr = getPolicyManager(realmName);
if (policyMgr != null) {
SubjectTypeManager subjectTypeMgr = policyMgr.getSubjectTypeManager();
Subject subject = subjectTypeMgr.getSubject(subjectType);
values = subject.getValidValues(getUserSSOToken(), filter);
}
} catch (AMConsoleException e) {
debug.warning("PolicyModelImpl.getSubjectPossibleValues", e);
} catch (NameNotFoundException e) {
debug.warning("PolicyModelImpl.getSubjectPossibleValues", e);
throw new AMConsoleException(getErrorString(e));
} catch (SSOException e) {
debug.warning("PolicyModelImpl.getSubjectPossibleValues", e);
throw new AMConsoleException(getErrorString(e));
} catch (PolicyException e) {
debug.warning("PolicyModelImpl.getSubjectPossibleValues", e);
throw new AMConsoleException(getErrorString(e));
}
return values;
}
Aggregations