context.getCredentials().addAll(getCredentials());
return context;
}
private Set<Credential> getCredentials() throws Exception {
UserPrincipal user = new UserPrincipal("testUser");
RolePrincipal role = new RolePrincipal("testRole");
GroupPrincipal parentGroup = new GroupPrincipal("testParentGroup");
parentGroup.addMember(user);
GroupPrincipal childGroup = new GroupPrincipal("testChildGroup");
childGroup.addMember(role);
parentGroup.addMember(childGroup);
Set<Credential> creds = new LinkedHashSet<Credential>();
creds.add(new AssertionCredential(new ElementPuller().pull(new StringReader("<testAssertion/>"))));
creds.add(SOAPMessageCredentialExtractorTests.getBinarySecurityTokenCertificateCredential());
creds.add(new ConfidentialityCredential(true));
creds.add(new ConfidentialityCredential(false));
creds.add(new NameCredential("testName"));
creds.add(new PasswordCredential("testPassword"));
creds.add(new PrincipalCredential(user, true));
creds.add(new PrincipalCredential(role, false));
creds.add(new PrincipalCredential(childGroup, true));
creds.add(new PrincipalCredential(parentGroup, false));
Subject childSubject = new Subject();
childSubject.getPrincipals().add(new UserPrincipal("childUser"));
creds.add(new SubjectCredential(childSubject));
return creds;
}