Examples of SecurityProviderImpl


Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        Map<String,Object> userParams = new HashMap();
        userParams.put(UserConstants.PARAM_ADMIN_ID, "admin");
        userParams.put(UserConstants.PARAM_OMIT_ADMIN_PW, true);

        ConfigurationParameters params = ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(userParams)));
        SecurityProvider sp = new SecurityProviderImpl(params);
        final ContentRepository repo = new Oak().with(new InitialContent())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(sp)
                .createContentRepository();

        ContentSession cs = Subject.doAs(SystemSubject.INSTANCE, new PrivilegedExceptionAction<ContentSession>() {
            @Override
            public ContentSession run() throws Exception {
                return repo.login(null, null);
            }
        });
        try {
            Root root = cs.getLatestRoot();
            UserConfiguration uc = sp.getConfiguration(UserConfiguration.class);
            UserManager umgr = uc.getUserManager(root, NamePathMapper.DEFAULT);
            Authorizable adminUser = umgr.getAuthorizable("admin");
            assertNotNull(adminUser);

            Tree adminTree = root.getTree(adminUser.getPath());
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

    public void testAnonymousConfiguration() throws Exception {
        Map<String,Object> userParams = new HashMap();
        userParams.put(UserConstants.PARAM_ANONYMOUS_ID, "");

        ConfigurationParameters params = ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(userParams)));
        SecurityProvider sp = new SecurityProviderImpl(params);
        final ContentRepository repo = new Oak().with(new InitialContent())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(sp)
                .createContentRepository();

        ContentSession cs = Subject.doAs(SystemSubject.INSTANCE, new PrivilegedExceptionAction<ContentSession>() {
            @Override
            public ContentSession run() throws Exception {
                return repo.login(null, null);
            }
        });
        try {
            Root root = cs.getLatestRoot();
            UserConfiguration uc = sp.getConfiguration(UserConfiguration.class);
            UserManager umgr = uc.getUserManager(root, NamePathMapper.DEFAULT);
            Authorizable anonymous = umgr.getAuthorizable(UserConstants.DEFAULT_ANONYMOUS_ID);
            assertNull(anonymous);
        } finally {
            cs.close();
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(securityProvider1 = new SecurityProviderImpl(getSecurityConfigParameters()));
        contentRepository1 = oak.createContentRepository();
        adminSession1 = login1(getAdminCredentials());
        root1 = adminSession1.getLatestRoot();
        userManager1 = securityProvider1.getConfiguration(UserConfiguration.class).getUserManager(root1, namePathMapper);
        aclMgr1 = securityProvider1.getConfiguration(AuthorizationConfiguration.class).getAccessControlManager(root1, namePathMapper);

        oak = new Oak(mk2)
                .with(new InitialContent())
                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(securityProvider2 = new SecurityProviderImpl(getSecurityConfigParameters()));

        contentRepository2 = oak.createContentRepository();
        adminSession2 = login2(getAdminCredentials());
        root2 = adminSession2.getLatestRoot();
        userManager2 = securityProvider2.getConfiguration(UserConfiguration.class).getUserManager(root2, namePathMapper);
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        }
    }

    protected SecurityProvider getSecurityProvider() {
        if (securityProvider == null) {
            securityProvider = new SecurityProviderImpl(getSecurityConfigParameters());
        }
        return securityProvider;
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

    //-----------------------------------------------------< BundleActivator >--

    @Override
    public void start(BundleContext bundleContext) throws Exception {
        context = bundleContext;
        securityProvider = new SecurityProviderImpl(); // TODO
        tracker = new ServiceTracker(
                context, ContentRepository.class.getName(), this);
        tracker.open();
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        }
    }

    protected SecurityProvider getSecurityProvider() {
        if (securityProvider == null) {
            securityProvider = new SecurityProviderImpl(getSecurityConfigParameters());
        }
        return securityProvider;
    }
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        with(new InitialContent());

        with(JcrConflictHandler.JCR_CONFLICT_HANDLER);
        with(new EditorHook(new VersionEditorProvider()));

        with(new SecurityProviderImpl());

        with(new ItemSaveValidatorProvider());
        with(new NameValidatorProvider());
        with(new NamespaceEditorProvider());
        with(new TypeEditorProvider());
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(securityProvider1 = new SecurityProviderImpl(getSecurityConfigParameters()));
        contentRepository1 = oak.createContentRepository();
        adminSession1 = login1(getAdminCredentials());
        root1 = adminSession1.getLatestRoot();
        userManager1 = securityProvider1.getConfiguration(UserConfiguration.class).getUserManager(root1, namePathMapper);
        aclMgr1 = securityProvider1.getConfiguration(AuthorizationConfiguration.class).getAccessControlManager(root1, namePathMapper);

        oak = new Oak(ns2)
                .with(new InitialContent())
                .with(new ReferenceEditorProvider())
                .with(new ReferenceIndexProvider())
                .with(new PropertyIndexEditorProvider())
                .with(new PropertyIndexProvider())
                .with(new TypeEditorProvider())
                .with(securityProvider2 = new SecurityProviderImpl(getSecurityConfigParameters()));

        contentRepository2 = oak.createContentRepository();
        adminSession2 = login2(getAdminCredentials());
        root2 = adminSession2.getLatestRoot();
        userManager2 = securityProvider2.getConfiguration(UserConfiguration.class).getUserManager(root2, namePathMapper);
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        if (importBehavior != null) {
            Map<String, String> userParams = new HashMap<String, String>();
            userParams.put(ProtectedItemImporter.PARAM_IMPORT_BEHAVIOR, getImportBehavior());
            ConfigurationParameters config = ConfigurationParameters.of(ImmutableMap.of(UserConfiguration.NAME, ConfigurationParameters.of(userParams)));

            securityProvider = new SecurityProviderImpl(config);
        } else {
            securityProvider = new SecurityProviderImpl();
        }
        Jcr jcr = new Jcr();
        jcr.with(securityProvider);
        repo = jcr.createRepository();
        adminSession = repo.login(new SimpleCredentials(UserConstants.DEFAULT_ADMIN_ID, UserConstants.DEFAULT_ADMIN_ID.toCharArray()));
View Full Code Here

Examples of org.apache.jackrabbit.oak.security.SecurityProviderImpl

        } else if (service instanceof NodeStore) {
            NodeStore store = (NodeStore) service;
            OakInitializer.initialize(store, repositoryInitializerTracker, indexEditorProvider);
            Oak oak = new Oak(store)
                // FIXME: proper osgi setup for security provider (see OAK-17 and sub-tasks)
                .with(new SecurityProviderImpl())
                .with(validatorProvider)
                .with(indexProvider)
                .with(indexEditorProvider);
            services.put(reference, context.registerService(
                    ContentRepository.class.getName(),
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.