use of org.apache.cxf.rt.security.claims.ClaimCollection in project ddf by codice.
the class CertificateClaimsHandlerTest method getClaims.
private ClaimCollection getClaims() throws URISyntaxException {
ClaimCollection claims = new ClaimCollection();
Claim claim = new Claim();
claim.setClaimType(new URI(SubjectUtils.COUNTRY_CLAIM_URI));
claims.add(claim);
Claim claim1 = new Claim();
claim1.setClaimType(new URI(SubjectUtils.EMAIL_ADDRESS_CLAIM_URI));
claims.add(claim1);
return claims;
}
use of org.apache.cxf.rt.security.claims.ClaimCollection in project ddf by codice.
the class CertificateClaimsHandlerTest method testRetrieveClaimValuesWithAltNamesNotRequested.
@Test
public void testRetrieveClaimValuesWithAltNamesNotRequested() throws URISyntaxException {
CertificateClaimsHandler certificateClaimsHandler = new CertificateClaimsHandler();
certificateClaimsHandler.setCountryClaim("Country");
certificateClaimsHandler.setEmailClaim("Email");
ClaimCollection claims = getClaims();
ClaimsParameters parameters = new ClaimsParameters();
parameters.setPrincipal(mock(Principal.class));
Map<String, Object> map = new HashMap<>();
map.put(SubjectUtils.EMAIL_ADDRESS_CLAIM_URI, "local@localhost");
map.put(SubjectUtils.COUNTRY_CLAIM_URI, "USA");
parameters.setAdditionalProperties(map);
ProcessedClaimCollection processedClaims = certificateClaimsHandler.retrieveClaimValues(claims, parameters);
assertThat(processedClaims.size(), is(0));
}
use of org.apache.cxf.rt.security.claims.ClaimCollection 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.rt.security.claims.ClaimCollection 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.rt.security.claims.ClaimCollection 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