Search in sources :

Example 36 with ConfigurationParameters

use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.

the class QueryUtilTest method testGetSearchRootNoCommonAncestor.

@Test
public void testGetSearchRootNoCommonAncestor() {
    ConfigurationParameters params = ConfigurationParameters.of(UserConstants.PARAM_USER_PATH, "/users", UserConstants.PARAM_GROUP_PATH, "/groups");
    Map<AuthorizableType, String> paths = ImmutableMap.of(AuthorizableType.USER, "/users", AuthorizableType.GROUP, "/groups", AuthorizableType.AUTHORIZABLE, "/");
    assertSearchRoot(paths, params);
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) AuthorizableType(org.apache.jackrabbit.oak.spi.security.user.AuthorizableType) Test(org.junit.Test)

Example 37 with ConfigurationParameters

use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.

the class UserUtilTest method testGetAdminId.

@Test
public void testGetAdminId() {
    String altAdminId = "test";
    ConfigurationParameters config = ConfigurationParameters.of(UserConstants.PARAM_ADMIN_ID, altAdminId);
    assertEquals(UserConstants.DEFAULT_ADMIN_ID, UserUtil.getAdminId(ConfigurationParameters.EMPTY));
    assertEquals(altAdminId, UserUtil.getAdminId(config));
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) Test(org.junit.Test)

Example 38 with ConfigurationParameters

use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.

the class UserUtilTest method testGetAuthorizableRootPath.

@Test
public void testGetAuthorizableRootPath() {
    ConfigurationParameters config = ConfigurationParameters.of(UserConstants.PARAM_GROUP_PATH, "/groups", UserConstants.PARAM_USER_PATH, "/users");
    assertEquals("/groups", UserUtil.getAuthorizableRootPath(config, AuthorizableType.GROUP));
    assertEquals("/users", UserUtil.getAuthorizableRootPath(config, AuthorizableType.USER));
    assertEquals("/", UserUtil.getAuthorizableRootPath(config, AuthorizableType.AUTHORIZABLE));
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) Test(org.junit.Test)

Example 39 with ConfigurationParameters

use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.

the class CustomLoginModule method initialize.

@Override
public void initialize(Subject subject, CallbackHandler callbackHandler, Map<String, ?> sharedState, Map<String, ?> options) {
    if (options != null) {
        ConfigurationParameters opts = ConfigurationParameters.of(options);
        config = (config == null) ? opts : ConfigurationParameters.of(config, opts);
    }
// EXERCISE
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)

Example 40 with ConfigurationParameters

use of org.apache.jackrabbit.oak.spi.security.ConfigurationParameters in project jackrabbit-oak by apache.

the class CustomExternalIdentityProvider method activate.

//----------------------------------------------------< SCR integration >---
@SuppressWarnings("UnusedDeclaration")
@Activate
public void activate(Map<String, Object> properties) {
    ConfigurationParameters config = ConfigurationParameters.of(properties);
    for (String entry : config.getConfigValue("externalidentities", Collections.<String>emptySet())) {
        String[] strs = Text.explode(entry, ',', false);
        String uid = strs[0].trim();
        Set<String> declaredGroups = new HashSet<String>();
        if (strs.length > 1) {
            for (int i = 1; i < strs.length; i++) {
                groupIds.add(strs[i]);
                declaredGroups.add(strs[i]);
            }
        }
        userGroupMap.put(uid, declaredGroups);
    }
    log.info("activated IDP: " + getName());
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) HashSet(java.util.HashSet) Activate(org.apache.felix.scr.annotations.Activate)

Aggregations

ConfigurationParameters (org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)44 Test (org.junit.Test)24 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)11 SimpleCredentials (javax.jcr.SimpleCredentials)6 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)6 Activate (org.apache.felix.scr.annotations.Activate)4 Tree (org.apache.jackrabbit.oak.api.Tree)4 SecurityProviderImpl (org.apache.jackrabbit.oak.security.SecurityProviderImpl)4 AuthorizableType (org.apache.jackrabbit.oak.spi.security.user.AuthorizableType)4 UserConfiguration (org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)4 Before (org.junit.Before)4 HashMap (java.util.HashMap)3 Nonnull (javax.annotation.Nonnull)3 LoginException (javax.security.auth.login.LoginException)3 Authorizable (org.apache.jackrabbit.api.security.user.Authorizable)3 UserManager (org.apache.jackrabbit.api.security.user.UserManager)3 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)3 Root (org.apache.jackrabbit.oak.api.Root)3 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)3 PropertyIndexProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider)3