Package org.apache.jackrabbit.core.security.authorization

Examples of org.apache.jackrabbit.core.security.authorization.AccessControlProvider


     * @see JackrabbitSecurityManager#dispose(String)
     */
    public void dispose(String workspaceName) {
        checkInitialized();
        synchronized (acProviders) {
            AccessControlProvider prov = acProviders.remove(workspaceName);
            if (prov != null) {
                prov.close();
            }
        }
    }
View Full Code Here


    public AccessManager getAccessManager(Session session, AMContext amContext) throws RepositoryException {
        checkInitialized();
        AccessManagerConfig amConfig = repository.getConfig().getSecurityConfig().getAccessManagerConfig();
        try {
            String wspName = session.getWorkspace().getName();
            AccessControlProvider pp = getAccessControlProvider(wspName);
            AccessManager accessMgr;
            if (amConfig == null) {
                log.debug("No configuration entry for AccessManager. Using org.apache.jackrabbit.core.security.DefaultAccessManager");
                accessMgr = new DefaultAccessManager();
            } else {
View Full Code Here

     * @throws RepositoryException
     */
    private AccessControlProvider getAccessControlProvider(String workspaceName)
            throws NoSuchWorkspaceException, RepositoryException {
        checkInitialized();
        AccessControlProvider provider = acProviders.get(workspaceName);
        if (provider == null || !provider.isLive()) {
            SystemSession systemSession = repository.getSystemSession(workspaceName);
            // mark this session as 'active' so the workspace does not get disposed
            // by the workspace-janitor until the garbage collector is done
            // TODO: review again... this workaround is now used in several places.
            repository.onSessionCreated(systemSession);
View Full Code Here

        /**
         * {@inheritDoc}
         */
        public boolean grants(Set<Principal> principals, String workspaceName) throws RepositoryException {
            AccessControlProvider prov = getAccessControlProvider(workspaceName);
            return prov.canAccessRoot(principals);
        }
View Full Code Here

     */
    public AccessManager getAccessManager(Session session, AMContext amContext) throws RepositoryException {
        checkInitialized();
        try {
            String wspName = session.getWorkspace().getName();
            AccessControlProvider acP = getAccessControlProvider(systemSession, wspName);

            AccessManagerConfig amc = config.getAccessManagerConfig();
            AccessManager accessMgr;
            if (amc == null) {
                accessMgr = new SimpleAccessManager();
View Full Code Here

        WorkspaceSecurityConfig ws = config.getSecurityConfig();
        if (ws != null) {
            BeanConfig ppfConfig =  ws.getAccessControlProviderConfig();
            if (ppfConfig != null) {
                AccessControlProvider prov = (AccessControlProvider) ppfConfig.newInstance();
            }
        }
    }
View Full Code Here

    public void testAnonymousAccessDenied() throws Exception {
        Map<String, String> config = new HashMap<String, String>();
        config.put(UserAccessControlProvider.PARAM_ANONYMOUS_ACCESS, "false");

        AccessControlProvider p2 = new UserAccessControlProvider();
        try {
            p2.init(s, config);

            Set<Principal> anonymousPrincipals = getAnonymousPrincipals();

            assertFalse(p2.canAccessRoot(anonymousPrincipals));

            CompiledPermissions cp = p2.compilePermissions(anonymousPrincipals);
            try {
                assertEquals(CompiledPermissions.NO_PERMISSION, cp);
                assertFalse(cp.canReadAll());
                assertFalse(cp.grants(((NodeImpl) s.getRootNode()).getPrimaryPath(), Permission.READ));
            } finally {
                cp.close();
            }
        } finally {
            p2.close();
        }
    }
View Full Code Here

    public void testAnonymousAccessDenied2() throws Exception {
        Map<String, String> config = new HashMap<String, String>();
        config.put(UserAccessControlProvider.PARAM_ANONYMOUS_ACCESS, "false");
        config.put(UserAccessControlProvider.PARAM_ANONYMOUS_ID, "abc");

        AccessControlProvider p2 = new UserAccessControlProvider();
        try {
            p2.init(s, config);

            Principal princ = new Principal() {
                public String getName() {
                    return "abc";
                }
            };
            Set<Principal> anonymousPrincipals = Collections.singleton(princ);

            assertFalse(p2.canAccessRoot(anonymousPrincipals));

            CompiledPermissions cp = p2.compilePermissions(anonymousPrincipals);
            try {
                assertEquals(CompiledPermissions.NO_PERMISSION, cp);
                assertFalse(cp.canReadAll());
                assertFalse(cp.grants(((NodeImpl) s.getRootNode()).getPrimaryPath(), Permission.READ));
            } finally {
                cp.close();
            }
        } finally {
            p2.close();
        }
    }
View Full Code Here

     * @see JackrabbitSecurityManager#dispose(String)
     */
    public void dispose(String workspaceName) {
        checkInitialized();
        synchronized (acProviders) {
            AccessControlProvider prov = acProviders.remove(workspaceName);
            if (prov != null) {
                prov.close();
            }
        }
    }
View Full Code Here

    public AccessManager getAccessManager(Session session, AMContext amContext) throws RepositoryException {
        checkInitialized();
        AccessManagerConfig amConfig = repository.getConfig().getSecurityConfig().getAccessManagerConfig();
        try {
            String wspName = session.getWorkspace().getName();
            AccessControlProvider pp = getAccessControlProvider(wspName);
            AccessManager accessMgr;
            if (amConfig == null) {
                log.debug("No configuration entry for AccessManager. Using org.apache.jackrabbit.core.security.DefaultAccessManager");
                accessMgr = new DefaultAccessManager();
            } else {
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.core.security.authorization.AccessControlProvider

Copyright © 2018 www.massapicom. 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.