}
catch (SSOException ssoex)
{
System.out.println("SSO Credential add FAILED for Group:" + TEST_GROUP + " site: " + TEST_URL);
ssoex.printStackTrace();
throw new Exception(ssoex.getMessage());
}
}
else
{
System.out.println("Group:" + TEST_GROUP + " site: " + TEST_URL + " has already a remote credential");
}
// Create Principal for User
principal = new UserPrincipalImpl(TEST_GROUP_USER);
principals = new HashSet();
principals.add(principal);
subject = new Subject(true, principals, new HashSet(), new HashSet());
// User should have credential for site
if (ssoBroker.hasSSOCredentials(subject, TEST_URL) == false)
{
// Group expansion failed. User not recognized
System.out.println("No SSO Credential for user:" + TEST_GROUP_USER + " site: " + TEST_URL);
// Test failure
try
{
ums.removeUser(TEST_GROUP_USER);
gms.removeGroup(TEST_GROUP);
}
catch (SecurityException sex)
{
assertTrue("could not remove user and group. exception caught: " + sex, false);
}
throw new Exception("SSO Unit test for Group support failed");
}
else
{
// Group lookup succesful
System.out.println("SSO Test for Group support successful" + "\nSSO Credential for user:" + TEST_GROUP_USER
+ " site: " + TEST_URL + " found. User is member of Group " + TEST_GROUP);
}
// Cleanup test.
/*
* For hypersonic the cascading deletes are not generated by Torque and the remove credentials fails with a
* constraint error. Comment test out for M1 release but the problem needs to be addressed for the upcoming
* releases
*/
try
{
// Remove credential for Site
ssoBroker.removeCredentialsForSite("/group/" + TEST_GROUP, TEST_URL);
System.out.println("SSO Credential removed for Group:" + TEST_GROUP + " site: " + TEST_URL);
}
catch (SSOException ssoex)
{
System.out.println("SSO Credential remove FAILED for Group:" + TEST_GROUP + " site: " + TEST_URL);
throw new Exception(ssoex.getMessage());
}
try
{
ums.removeUser(TEST_GROUP_USER);