use of org.dcache.auth.EmailAddressPrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method shouldFailWhenWrongMapFormatEmail2.
@Test
public void shouldFailWhenWrongMapFormatEmail2() throws Exception {
givenConfig("email:kermit.dcache.org username:kermit");
whenMapping(new EmailAddressPrincipal("kermit@dcache.org"));
assertThat(warnings, is(not(empty())));
assertThat(mappedPrincipals, is(empty()));
}
use of org.dcache.auth.EmailAddressPrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method testRefresh.
@Test
public void testRefresh() throws Exception {
givenConfig(" \n");
givenConfigHasBeenRead();
givenConfig("email:kermit@dcache.org username:kermit\n");
whenMapping(new EmailAddressPrincipal("kermit@dcache.org"));
assertThat(warnings, is(empty()));
assertThat(mappedPrincipals, hasItem(new UserNamePrincipal("kermit")));
}
use of org.dcache.auth.EmailAddressPrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method shouldPassWhenEmailMapped.
@Test
public void shouldPassWhenEmailMapped() throws Exception {
givenConfig("email:kermit@dcache.org username:kermit");
whenMapping(new EmailAddressPrincipal("kermit@dcache.org"));
assertThat(warnings, is(empty()));
assertThat(mappedPrincipals, hasItem(new UserNamePrincipal("kermit")));
}
use of org.dcache.auth.EmailAddressPrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method shouldPassWhenEmailMapped2.
@Test
public void shouldPassWhenEmailMapped2() throws Exception {
givenConfig("\"email:kermit@dcache.org\" \"username:kermit\"");
whenMapping(new EmailAddressPrincipal("kermit@dcache.org"));
assertThat(warnings, is(empty()));
assertThat(mappedPrincipals, hasItem(new UserNamePrincipal("kermit")));
}
use of org.dcache.auth.EmailAddressPrincipal in project dcache by dCache.
the class X509Plugin method identifyPrincipalsFromEEC.
private List<Principal> identifyPrincipalsFromEEC(X509Certificate eec) throws AuthenticationException, CertificateParsingException {
Set<Principal> caPrincipals = identifyPrincipalsFromIssuer(eec);
List<String> policies = listPolicies(eec);
List<Principal> loaPrincipals = policies.stream().flatMap(X509Plugin::loaPrincipals).collect(Collectors.toList());
Collection<List<?>> san = listSubjectAlternativeNames(eec);
List<Principal> emailPrincipals = subjectAlternativeNamesWithTag(san, GeneralName.rfc822Name).filter(EmailAddressPrincipal::isValid).map(EmailAddressPrincipal::new).collect(Collectors.toList());
Principal subject = new GlobusPrincipal(eec.getSubjectX500Principal());
Optional<EntityDefinition> entity = identifyEntityDefinition(eec, policies, subject, san);
List<Principal> principals = new ArrayList<>();
principals.addAll(caPrincipals);
principals.addAll(loaPrincipals);
principals = filterOutErroneousLoAs(subject, principals);
addImpliedLoA(entity, principals);
principals.add(subject);
principals.addAll(emailPrincipals);
entity.map(EntityDefinitionPrincipal::new).ifPresent(principals::add);
return principals;
}
Aggregations