use of org.apache.cxf.sts.claims.ProcessedClaimCollection in project ddf by codice.
the class TestAttributeFileClaimsHandler method testRetrieveClaimValuesLocalhost.
@Test
public void testRetrieveClaimValuesLocalhost() {
ProcessedClaimCollection processedClaims = attributeFileClaimsHandler.retrieveClaimValues(claimCollection, localhostClaimsParameters);
assertThat(processedClaims.size(), is(0));
}
use of org.apache.cxf.sts.claims.ProcessedClaimCollection in project ddf by codice.
the class TestAttributeFileClaimsHandler method testRetrieveClaimsValuesNullPrincipal.
@Test
public void testRetrieveClaimsValuesNullPrincipal() {
ClaimsParameters claimsParameters = new ClaimsParameters();
ClaimCollection claimCollection = new ClaimCollection();
ProcessedClaimCollection processedClaims = attributeFileClaimsHandler.retrieveClaimValues(claimCollection, claimsParameters);
Assert.assertThat(processedClaims.size(), CoreMatchers.is(equalTo(0)));
}
use of org.apache.cxf.sts.claims.ProcessedClaimCollection in project ddf by codice.
the class TestAttributeQueryClaimsHandler method testRetrieveClaimValues.
@Test
public void testRetrieveClaimValues() throws Exception {
ProcessedClaimCollection processedClaimCollection = retrieveClaimValues();
// Test that the claims were created and mapped correctly.
assertThat(processedClaimCollection.size(), is(equalTo(3)));
assertThat(processedClaimCollection.get(0).getClaimType().toString(), is(equalTo("Role")));
assertThat((String) processedClaimCollection.get(0).getValues().get(0), is(equalTo("Guest-hasMapping")));
assertThat(processedClaimCollection.get(1).getClaimType().toString(), is(equalTo("NameIdentifier")));
assertThat((String) processedClaimCollection.get(1).getValues().get(0), is(equalTo("Name-hasMapping")));
// Does not have an attribute mapping.
assertThat(processedClaimCollection.get(2).getClaimType().toString(), is(equalTo("Email")));
assertThat((String) processedClaimCollection.get(2).getValues().get(0), is(equalTo("email")));
}
use of org.apache.cxf.sts.claims.ProcessedClaimCollection in project ddf by codice.
the class TestAttributeQueryClaimsHandler method testRetrieveClaimsValuesNullPrincipal.
@Test
public void testRetrieveClaimsValuesNullPrincipal() {
ClaimsParameters claimsParameters = mock(ClaimsParameters.class);
when(claimsParameters.getPrincipal()).thenReturn(null);
ClaimCollection claimCollection = new ClaimCollection();
ProcessedClaimCollection processedClaims = spyAttributeQueryClaimsHandler.retrieveClaimValues(claimCollection, claimsParameters);
assertThat(processedClaims.size(), is(equalTo(0)));
}
use of org.apache.cxf.sts.claims.ProcessedClaimCollection in project ddf by codice.
the class TestAttributeQueryClaimsHandler method retrieveClaimValues.
private ProcessedClaimCollection retrieveClaimValues() {
ClaimCollection claimCollection = new ClaimCollection();
Claim claim = new Claim();
try {
claim.setClaimType(new URI("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"));
} catch (URISyntaxException e) {
fail("Could not create URI.");
}
claimCollection.add(claim);
ClaimsParameters claimsParameters = mock(ClaimsParameters.class);
Principal principal = mock(Principal.class);
when(principal.getName()).thenReturn(USERNAME);
when(claimsParameters.getPrincipal()).thenReturn(principal);
return spyAttributeQueryClaimsHandler.retrieveClaimValues(claimCollection, claimsParameters);
}
Aggregations