Search in sources :

Example 26 with ConfigurationParameters

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

the class CugConfigurationWithMountsTest method testDefaultMountInfoProvider.

@Test
public void testDefaultMountInfoProvider() {
    CugConfiguration configuration = createConfiguration(Mounts.defaultMountInfoProvider());
    ConfigurationParameters params = configuration.getParameters();
    assertSame(Mounts.defaultMountInfoProvider(), params.get(CugConstants.PARAM_MOUNT_PROVIDER));
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 27 with ConfigurationParameters

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

the class SecurityProviderRegistration method createSecurityProvider.

private SecurityProvider createSecurityProvider(@Nonnull BundleContext context) {
    InternalSecurityProvider securityProvider = new InternalSecurityProvider();
    // Static, mandatory references
    securityProvider.setAuthenticationConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, authenticationConfiguration));
    securityProvider.setPrivilegeConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, privilegeConfiguration));
    ConfigurationParameters userParams = ConfigurationParameters.of(ConfigurationParameters.of(UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, createWhiteboardAuthorizableActionProvider()), ConfigurationParameters.of(UserConstants.PARAM_AUTHORIZABLE_NODE_NAME, createWhiteboardAuthorizableNodeName()), ConfigurationParameters.of(UserConstants.PARAM_USER_AUTHENTICATION_FACTORY, createWhiteboardUserAuthenticationFactory()));
    securityProvider.setUserConfiguration(ConfigurationInitializer.initializeConfiguration(securityProvider, userConfiguration, userParams));
    // Multiple, dynamic references
    ConfigurationParameters restrictionParams = ConfigurationParameters.of(AccessControlConstants.PARAM_RESTRICTION_PROVIDER, createWhiteboardRestrictionProvider());
    ConfigurationInitializer.initializeConfigurations(securityProvider, authorizationConfiguration, restrictionParams);
    securityProvider.setAuthorizationConfiguration(authorizationConfiguration);
    ConfigurationInitializer.initializeConfigurations(securityProvider, principalConfiguration, ConfigurationParameters.EMPTY);
    securityProvider.setPrincipalConfiguration(principalConfiguration);
    ConfigurationInitializer.initializeConfigurations(securityProvider, tokenConfiguration, ConfigurationParameters.EMPTY);
    securityProvider.setTokenConfiguration(tokenConfiguration);
    // Whiteboard
    securityProvider.setWhiteboard(new OsgiWhiteboard(context));
    return securityProvider;
}
Also used : OsgiWhiteboard(org.apache.jackrabbit.oak.osgi.OsgiWhiteboard) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters)

Example 28 with ConfigurationParameters

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

the class AccessControlAction method isBuiltInUser.

private boolean isBuiltInUser(@Nonnull Authorizable authorizable) throws RepositoryException {
    ConfigurationParameters userConfig = securityProvider.getConfiguration(UserConfiguration.class).getParameters();
    String userId = authorizable.getID();
    return UserUtil.getAdminId(userConfig).equals(userId) || UserUtil.getAnonymousId(userConfig).equals(userId);
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)

Example 29 with ConfigurationParameters

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

the class ReadPolicyTest method before.

@Override
@Before
public void before() throws Exception {
    super.before();
    ConfigurationParameters options = getConfig(AuthorizationConfiguration.class).getParameters();
    readPaths = options.getConfigValue(PermissionConstants.PARAM_READ_PATHS, PermissionConstants.DEFAULT_READ_PATHS);
}
Also used : AuthorizationConfiguration(org.apache.jackrabbit.oak.spi.security.authorization.AuthorizationConfiguration) ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) Before(org.junit.Before)

Example 30 with ConfigurationParameters

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

the class TokenConfigurationImplOSGiTest method testGetParameters.

@Test
public void testGetParameters() {
    ConfigurationParameters params = tokenConfiguration.getParameters();
    assertEquals(25, params.getConfigValue(TokenProvider.PARAM_TOKEN_EXPIRATION, TokenProviderImpl.DEFAULT_TOKEN_EXPIRATION).longValue());
    assertEquals(4, params.getConfigValue(TokenProvider.PARAM_TOKEN_LENGTH, TokenProviderImpl.DEFAULT_KEY_SIZE).intValue());
}
Also used : ConfigurationParameters(org.apache.jackrabbit.oak.spi.security.ConfigurationParameters) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

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