use of org.dcache.auth.GroupNamePrincipal in project dcache by dCache.
the class StrategyIdMapper method principalToGid.
@Override
public int principalToGid(String name) {
try {
String principal = stripDomain(name);
Principal gidPrincipal = _remoteLoginStrategy.map(new GroupNamePrincipal(principal));
if (gidPrincipal instanceof GidPrincipal) {
return (int) ((GidPrincipal) gidPrincipal).getGid();
}
} catch (CacheException e) {
LOGGER.debug("Failed to map principal {} : {}", name, e);
}
return tryNumericIfAllowed(name);
}
use of org.dcache.auth.GroupNamePrincipal in project dcache by dCache.
the class OidcAuthPluginTest method shouldAcceptWlcgProfileWithAuthzAndNonAuthzPrincipal.
@Test
public void shouldAcceptWlcgProfileWithAuthzAndNonAuthzPrincipal() throws Exception {
Properties properties = new Properties();
properties.setProperty("gplazma.oidc.provider!EXAMPLE", "https://oidc.example.org/ -profile=wlcg -prefix=/target -authz-id=group:authz-group -non-authz-id=group:non-authz-group");
var identityProviders = OidcAuthPlugin.buildProviders(properties, aClient().build(), Duration.ofSeconds(2));
assertThat(identityProviders, hasSize(1));
IdentityProvider provider = identityProviders.iterator().next();
assertThat(provider.getProfile(), is(instanceOf(WlcgProfile.class)));
WlcgProfile authzWGProfile = (WlcgProfile) provider.getProfile();
assertThat(authzWGProfile.getPrefix(), is(equalTo(FsPath.create("/target"))));
assertThat(authzWGProfile.getAuthzIdentity(), contains(new GroupNamePrincipal("authz-group")));
assertThat(authzWGProfile.getNonAuthzIdentity(), contains(new GroupNamePrincipal("non-authz-group")));
}
use of org.dcache.auth.GroupNamePrincipal in project dcache by dCache.
the class OidcAuthPluginTest method shouldAcceptWlcgProfileWithNonAuthzPrincipal.
@Test
public void shouldAcceptWlcgProfileWithNonAuthzPrincipal() throws Exception {
Properties properties = new Properties();
properties.setProperty("gplazma.oidc.provider!EXAMPLE", "https://oidc.example.org/ -profile=wlcg -prefix=/target -non-authz-id=group:my-group");
var identityProviders = OidcAuthPlugin.buildProviders(properties, aClient().build(), Duration.ofSeconds(2));
assertThat(identityProviders, hasSize(1));
IdentityProvider provider = identityProviders.iterator().next();
assertThat(provider.getProfile(), is(instanceOf(WlcgProfile.class)));
WlcgProfile authzWGProfile = (WlcgProfile) provider.getProfile();
assertThat(authzWGProfile.getPrefix(), is(equalTo(FsPath.create("/target"))));
assertThat(authzWGProfile.getAuthzIdentity(), is(empty()));
assertThat(authzWGProfile.getNonAuthzIdentity(), contains(new GroupNamePrincipal("my-group")));
}
use of org.dcache.auth.GroupNamePrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method shouldMatchNonPrimarySpecificGroupWithNonPrimaryGroup.
@Test
public void shouldMatchNonPrimarySpecificGroupWithNonPrimaryGroup() throws Exception {
givenConfig("group:test gid:1000,false");
whenMapping(new GroupNamePrincipal("test", false));
assertThat(warnings, is(empty()));
assertThat(mappedPrincipals, hasItem(new GidPrincipal(1000, false)));
}
use of org.dcache.auth.GroupNamePrincipal in project dcache by dCache.
the class GplazmaMultiMapFileTest method shouldMatchNonPrimarySpecificGroupWithPrimaryGroup.
@Test
public void shouldMatchNonPrimarySpecificGroupWithPrimaryGroup() throws Exception {
givenConfig("group:test gid:1000,false");
whenMapping(new GroupNamePrincipal("test", true));
assertThat(warnings, is(empty()));
assertThat(mappedPrincipals, hasItem(new GidPrincipal(1000, false)));
}
Aggregations