Package org.geoserver.xacml.geoxacml

Source Code of org.geoserver.xacml.geoxacml.XACMLDefaultDataAccessManagerAuthTest

/* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
* This code is licensed under the GPL 2.0 license, availible at the root
* application directory.
*/

package org.geoserver.xacml.geoxacml;

import org.acegisecurity.providers.TestingAuthenticationToken;
import org.geoserver.security.DataAccessManager;
import org.geoserver.security.DefaultDataAccessManagerAuthTest;
import org.geoserver.xacml.role.XACMLRole;
import org.geoserver.xacml.security.XACMLDataAccessManager;

public class XACMLDefaultDataAccessManagerAuthTest extends DefaultDataAccessManagerAuthTest {

    @Override
    protected DataAccessManager buildManager(String propertyFile) throws Exception {

        if ("wideOpen.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/wideOpen/");
        }
        if ("publicRead.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/publicRead/");
        }
        if ("lockedDownHide.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/lockedDownHide/");
        }
        if ("lockedDownMixed.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/lockedDownMixed/");
        }
        if ("lockedDownChallenge.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/lockedDownChallenge/");
        }
        if ("lockedDown.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/lockedDown/");
        }
        if ("complex.properties".equals(propertyFile)) {
            GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/complex/");
        }

        GeoXACMLConfig.reset();
        return new XACMLDataAccessManager();

    }

    @Override
    public void testUnknownMode() throws Exception {
        // already tested with "lockedDown"
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();

        rwUser = new TestingAuthenticationToken("rw", "supersecret", new XACMLRole[] {
                new XACMLRole("READER"), new XACMLRole("WRITER") });
        roUser = new TestingAuthenticationToken("ro", "supersecret",
                new XACMLRole[] { new XACMLRole("READER") });
        anonymous = new TestingAuthenticationToken("anonymous", "",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AnonymousRole) });
        milUser = new TestingAuthenticationToken("military", "supersecret",
                new XACMLRole[] { new XACMLRole("MILITARY") });
        root = new TestingAuthenticationToken("admin", "geoserver",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AdminRole) });

    }
}
TOP

Related Classes of org.geoserver.xacml.geoxacml.XACMLDefaultDataAccessManagerAuthTest

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.