Package org.geoserver.xacml.role

Examples of org.geoserver.xacml.role.XACMLRole


    @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) });

    }
View Full Code Here


        GeoXACMLConfig.getXACMLRoleAuthority().prepareRoles(auth);

        List<RequestCtx> resultList = new ArrayList<RequestCtx>();

        for (GrantedAuthority role : auth.getAuthorities()) {
            XACMLRole xacmlRole = (XACMLRole) role;
            if (xacmlRole.isEnabled() == false)
                continue;
            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getURLMatchRequestCtxBuilder(xacmlRole, urlPath, method, httpParams,remoteIP,remoteHost)
                    .createRequestCtx();
            // XACMLUtil.getXACMLLogger().info(XACMLUtil.asXMLString(requestCtx));
View Full Code Here

        asia.setNamespace(nameSpace);
        asia.setName("asia");

        GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/publicReadGeoRestricted/");
        GeoXACMLConfig.reset();
        role = new XACMLRole("ROLE_ANONYMOUS");
    }
View Full Code Here

    @Override
    protected Authentication createAuthentication(ServletRequest request) {
        GrantedAuthority[] auths = getUserAttribute().getAuthorities();
        XACMLRole[] roles = new XACMLRole[auths.length];
        for (int i = 0; i < auths.length; i++) {
            roles[i] = new XACMLRole(auths[i].getAuthority());
            roles[i].setRoleAttributesProcessed(true); // No userinfo for anonymous
        }

        AnonymousAuthenticationToken auth = new AnonymousAuthenticationToken(getKey(),
                getUserAttribute().getPassword(), roles);
View Full Code Here

        SecurityContextHolder.getContext().setAuthentication(reader);
        // ///////
        GeoXACMLConfig.getXACMLRoleAuthority().prepareRoles(reader);

        // //////
        XACMLRole readerRole = (XACMLRole) reader.getAuthorities()[0];

        RequestCtx request = GeoXACMLConfig.getRequestCtxBuilderFactory()
                .getResourceInfoRequestCtxBuilder(readerRole, europe, AccessMode.READ)
                .createRequestCtx();
View Full Code Here

    @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) });

    }
View Full Code Here

            WorkspaceInfo workspaceInfo, AccessMode mode) {

        List<RequestCtx> resultList = new ArrayList<RequestCtx>();

        for (GrantedAuthority role : auth.getAuthorities()) {
            XACMLRole xacmlRole = (XACMLRole) role;
            if (xacmlRole.isEnabled() == false)
                continue;
            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getWorkspaceRequestCtxBuilder(xacmlRole, workspaceInfo, mode)
                    .createRequestCtx();
            // XACMLUtil.getXACMLLogger().info(XACMLUtil.asXMLString(requestCtx));
View Full Code Here

            ResourceInfo resourceInfo, AccessMode mode) {

        List<RequestCtx> resultList = new ArrayList<RequestCtx>();

        for (GrantedAuthority role : auth.getAuthorities()) {
            XACMLRole xacmlRole = (XACMLRole) role;
            if (xacmlRole.isEnabled() == false)
                continue;
            RequestCtx requestCtx = GeoXACMLConfig.getRequestCtxBuilderFactory()
                    .getResourceInfoRequestCtxBuilder(xacmlRole, resourceInfo, mode)
                    .createRequestCtx();
            // XACMLUtil.getXACMLLogger().info(XACMLUtil.asXMLString(requestCtx));
View Full Code Here

        List<AuthenticationProvider> list = new ArrayList<AuthenticationProvider>();
        list.add(new TestingAuthenticationProvider());
        providerManager.setProviders(list);

        Authentication admin = new TestingAuthenticationToken("admin", "geoserver",
                new GrantedAuthority[] { new XACMLRole("ROLE_ADMINISTRATOR") });
        // Authentication anonymous = new TestingAuthenticationToken("anonymous", null, null);
        SecurityContextHolder.getContext().setAuthentication(admin);

    }
View Full Code Here

        super.setUp();
        GeoXACMLConfig.setPolicyRepsoitoryBaseDir("src/test/resources/urltest/");
        GeoXACMLConfig.reset();
        anonymous = new TestingAuthenticationToken("anonymous", "passwd",
                new XACMLRole[] { new XACMLRole(XACMLConstants.AnonymousRole) });
        admin = new TestingAuthenticationToken("admin", "passwd", new XACMLRole[] { new XACMLRole(
                XACMLConstants.AdminRole) });
        authenticated = new TestingAuthenticationToken("xy", "passwd",
                new XACMLRole[] { new XACMLRole(XACMLConstants.Authenticated) });
    }
View Full Code Here

TOP

Related Classes of org.geoserver.xacml.role.XACMLRole

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.