Search in sources :

Example 1 with UserConfiguration

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

the class SecurityProviderRegistrationTest method testBindUnbindUserConfiguration.

@Test
public void testBindUnbindUserConfiguration() throws Exception {
    Field f = registration.getClass().getDeclaredField("userConfiguration");
    f.setAccessible(true);
    assertNull(f.get(registration));
    UserConfiguration uc = mockConfiguration(UserConfiguration.class);
    registration.bindUserConfiguration(uc);
    assertSame(uc, f.get(registration));
    registration.unbindUserConfiguration(uc);
    assertNull(f.get(registration));
}
Also used : Field(java.lang.reflect.Field) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 2 with UserConfiguration

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

the class LdapLoginTestBase method before.

@Before
public void before() throws Exception {
    super.before();
    if (!USE_COMMON_LDAP_FIXTURE) {
        LDAP_SERVER.setUp();
        createLdapFixture();
    }
    UserConfiguration uc = securityProvider.getConfiguration(UserConfiguration.class);
    userManager = uc.getUserManager(root, NamePathMapper.DEFAULT);
}
Also used : UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) Before(org.junit.Before)

Example 3 with UserConfiguration

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

the class LoginModuleImpl method getUserAuthentication.

@CheckForNull
private Authentication getUserAuthentication(@Nullable String loginName) {
    SecurityProvider securityProvider = getSecurityProvider();
    Root root = getRoot();
    if (securityProvider != null && root != null) {
        UserConfiguration uc = securityProvider.getConfiguration(UserConfiguration.class);
        UserAuthenticationFactory factory = uc.getParameters().getConfigValue(UserConstants.PARAM_USER_AUTHENTICATION_FACTORY, null, UserAuthenticationFactory.class);
        if (factory != null) {
            return factory.getAuthentication(uc, root, loginName);
        } else {
            log.error("No user authentication factory configured in user configuration.");
        }
    }
    return null;
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) UserAuthenticationFactory(org.apache.jackrabbit.oak.spi.security.user.UserAuthenticationFactory) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) CheckForNull(javax.annotation.CheckForNull)

Example 4 with UserConfiguration

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

the class PrincipalConfigurationImpl method getPrincipalProvider.

@Nonnull
@Override
public PrincipalProvider getPrincipalProvider(Root root, NamePathMapper namePathMapper) {
    UserConfiguration uc = getSecurityProvider().getConfiguration(UserConfiguration.class);
    PrincipalProvider principalProvider = uc.getUserPrincipalProvider(root, namePathMapper);
    if (principalProvider != null) {
        // use user-implementation specific principal provider implementation
        return principalProvider;
    } else {
        // use default implementation acting on user management API
        return new PrincipalProviderImpl(root, uc, namePathMapper);
    }
}
Also used : PrincipalProvider(org.apache.jackrabbit.oak.spi.security.principal.PrincipalProvider) UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration) Nonnull(javax.annotation.Nonnull)

Example 5 with UserConfiguration

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

the class PermissionValidatorProvider method getUserContext.

Context getUserContext() {
    if (userCtx == null) {
        UserConfiguration uc = securityProvider.getConfiguration(UserConfiguration.class);
        userCtx = uc.getContext();
    }
    return userCtx;
}
Also used : UserConfiguration(org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)

Aggregations

UserConfiguration (org.apache.jackrabbit.oak.spi.security.user.UserConfiguration)15 Root (org.apache.jackrabbit.oak.api.Root)7 Test (org.junit.Test)7 UserManager (org.apache.jackrabbit.api.security.user.UserManager)4 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)4 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)4 InitialContent (org.apache.jackrabbit.oak.InitialContent)3 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)3 PropertyIndexProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexProvider)3 TypeEditorProvider (org.apache.jackrabbit.oak.plugins.nodetype.TypeEditorProvider)3 SecurityProviderImpl (org.apache.jackrabbit.oak.security.SecurityProviderImpl)3 SecurityConfiguration (org.apache.jackrabbit.oak.spi.security.SecurityConfiguration)3 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 CheckForNull (javax.annotation.CheckForNull)2 Nonnull (javax.annotation.Nonnull)2 GuestCredentials (javax.jcr.GuestCredentials)2 RepositoryException (javax.jcr.RepositoryException)2 SimpleCredentials (javax.jcr.SimpleCredentials)2 LoginException (javax.security.auth.login.LoginException)2