use of com.iplanet.sso.SSOToken in project OpenAM by OpenRock.
the class TokenResource method getUid.
private AMIdentity getUid(Context context) throws SSOException, IdRepoException, UnauthorizedClientException {
String cookie = getCookieFromServerContext(context);
SSOTokenManager mgr = SSOTokenManager.getInstance();
SSOToken token = mgr.createSSOToken(cookie);
return identityManager.getResourceOwnerIdentity(token.getProperty("UserToken"), token.getProperty("Organization"));
}
use of com.iplanet.sso.SSOToken in project OpenAM by OpenRock.
the class Issue619Test method testGetPolicyDecision.
@Test(groups = { "policy-client" })
@Parameters({ "orgName", "userName", "password", "serviceName", "resourceName", "actionName" })
public void testGetPolicyDecision(String orgName, String userName, String password, String serviceName, String resourceName, String actionName) throws Exception {
entering("testGetPolicyDecision()", null);
log(Level.INFO, "orgName:", orgName);
log(Level.INFO, "userName:", userName);
log(Level.INFO, "password:", password);
log(Level.INFO, "serviceName:", serviceName);
log(Level.INFO, "resourceName:", resourceName);
log(Level.INFO, "actionName:", actionName);
SSOToken token = TokenUtils.getSessionToken(orgName, userName, password);
log(Level.INFO, "Created ssoToken", "\n");
PolicyEvaluator pe = PolicyEvaluatorFactory.getInstance().getPolicyEvaluator(serviceName);
Map env = new HashMap();
Set attrSet = new HashSet();
//attrSet.add(invocatorUuid);
log(Level.INFO, "set auth level in envMap as a set containing " + "/:1, /:2", "\n");
attrSet.add("/:1");
attrSet.add("/:2");
env.put(Condition.REQUEST_AUTH_LEVEL, attrSet);
log(Level.INFO, "env Map:" + env, "\n");
Set actions = new HashSet();
actions.add(actionName);
PolicyDecision pd = pe.getPolicyDecision(token, resourceName, actions, env);
log(Level.INFO, "PolicyDecision XML:", pd.toXML());
entering("testGetPolicyDecision()", null);
}
use of com.iplanet.sso.SSOToken in project OpenAM by OpenRock.
the class Issue736Test method testGetPolicyDecision.
@Test(groups = { "policy-client" })
@Parameters({ "orgName", "userName", "password", "serviceName", "actionName" })
public void testGetPolicyDecision(String orgName, String userName, String password, String serviceName, String actionName) throws Exception {
entering("Issue736Test.testGetPolicyDecision()", null);
String resourceName = "http://host1.sample.com:80/banner.html";
log(Level.INFO, "orgName:", orgName);
log(Level.INFO, "userName:", userName);
log(Level.INFO, "password:", password);
log(Level.INFO, "serviceName:", serviceName);
log(Level.INFO, "resourceName:", resourceName);
log(Level.INFO, "actionName:", actionName);
SSOToken token = TokenUtils.getSessionToken(orgName, userName, password);
log(Level.INFO, "Created ssoToken", "\n");
PolicyEvaluator pe = PolicyEvaluatorFactory.getInstance().getPolicyEvaluator(serviceName);
Set actions = new HashSet();
actions.add(actionName);
PolicyDecision pd = pe.getPolicyDecision(token, resourceName, actions, //null envMap
null);
log(Level.INFO, "PolicyDecision XML:", pd.toXML());
entering("testGetPolicyDecision()", null);
}
use of com.iplanet.sso.SSOToken in project OpenAM by OpenRock.
the class PolicyEvaluatorTest method testGetPolicyDecision.
@Test(groups = { "policy-client" })
@Parameters({ "orgName", "userName", "password", "serviceName", "resourceName", "actionName" })
public void testGetPolicyDecision(String orgName, String userName, String password, String serviceName, String resourceName, String actionName) throws Exception {
entering("testGetPolicyDecision()", null);
log(Level.INFO, "orgName:", orgName);
log(Level.INFO, "userName:", userName);
log(Level.INFO, "password:", password);
log(Level.INFO, "serviceName:", serviceName);
log(Level.INFO, "resourceName:", resourceName);
log(Level.INFO, "actionName:", actionName);
SSOToken token = TokenUtils.getSessionToken(orgName, userName, password);
log(Level.INFO, "Created ssoToken", "\n");
PolicyEvaluator pe = PolicyEvaluatorFactory.getInstance().getPolicyEvaluator(serviceName);
Map env = new HashMap();
Set attrSet = new HashSet();
//attrSet.add(invocatorUuid);
env.put("invocatorPrincipalUuid", attrSet);
log(Level.INFO, "env Map:" + env, "\n");
Set actions = new HashSet();
actions.add(actionName);
PolicyDecision pd = pe.getPolicyDecision(token, resourceName, actions, env);
log(Level.INFO, "PolicyDecision XML:", pd.toXML());
entering("testGetPolicyDecision()", null);
}
use of com.iplanet.sso.SSOToken in project OpenAM by OpenRock.
the class RealmTest method createRealmWithSameName.
/**
* Test case of creating a new with the same name. Should throw
* an SMSException that realm already exists.
*/
@Test(groups = ("api"), expectedExceptions = { SMSException.class })
public void createRealmWithSameName() throws SMSException, SSOException {
OrganizationConfigManager ocm = null;
String realm = "sm-noissue-create-realm-with-same-name";
try {
SSOToken token = getAdminSSOToken();
ocm = new OrganizationConfigManager(token, "/");
ocm.createSubOrganization(realm, Collections.EMPTY_MAP);
ocm.createSubOrganization(realm, Collections.EMPTY_MAP);
} finally {
if (ocm != null) {
ocm.deleteSubOrganization(realm, true);
}
}
}
Aggregations