Package org.geoserver.security.config

Examples of org.geoserver.security.config.SecurityManagerConfig


        if (secMgr.listFilters().contains("custom")) {
            secMgr.removeFilter(secMgr.loadFilterConfig("custom"));
        }
        secMgr.getSecurityConfig().getFilterChain().remove("custom");
       
        SecurityManagerConfig mgrConfig = secMgr.getSecurityConfig();
        secMgr.saveSecurityConfig(mgrConfig);
    }
View Full Code Here


        config.setName("custom");
        config.setClassName(Filter.class.getName());
        config.setAssertAuth(assertSecurityContext);       
        secMgr.saveFilter(config);

        SecurityManagerConfig mgrConfig = secMgr.getSecurityConfig();
        mgrConfig.setConfigPasswordEncrypterName(getPlainTextPasswordEncoder().getName());

        mgrConfig.getFilterChain().remove("custom");
        if (pos==Pos.FIRST)
            mgrConfig.getFilterChain().insertFirst("/**""custom");
        if (pos==Pos.LAST)
            mgrConfig.getFilterChain().insertLast("/**""custom");
        if (pos==Pos.BEFORE)
            mgrConfig.getFilterChain().insertBefore("/**""custom",relativeTo);
        if (pos==Pos.AFTER)
            mgrConfig.getFilterChain().insertAfter("/**""custom",relativeTo);
       
        secMgr.saveSecurityConfig(mgrConfig);
    }
View Full Code Here

        config.setName("custom");
        config.setClassName(AuthProvider.class.getName());
        secMgr.saveAuthenticationProvider(config);
       

        SecurityManagerConfig mgrConfig = secMgr.getSecurityConfig();
        mgrConfig.getAuthProviderNames().add("custom");
        mgrConfig.setConfigPasswordEncrypterName(getPlainTextPasswordEncoder().getName());
        secMgr.saveSecurityConfig(mgrConfig);

        Authentication auth = new UsernamePasswordAuthenticationToken("foo", "bar");
        auth = getSecurityManager().authenticate(auth);
        assertTrue(auth.isAuthenticated());
View Full Code Here

        form.add(new EncryptionPanel("encryption"));
        form.add(new HelpLink("encryptionHelp").setDialog(dialog));
        form.add(new SubmitLink("save", form) {
            @Override
            public void onSubmit() {
                SecurityManagerConfig config = (SecurityManagerConfig) getForm().getModelObject();
              try {
                  getSecurityManager().saveSecurityConfig(config);
                  doReturn();
              } catch (Exception e) {
                  error(e);
View Full Code Here

        rstore.setParentRole(derived, root);
        rstore.associateRoleToUser(derived, testUserName);
        rstore.associateRoleToUser(derived, "castest");
        rstore.store();
       
        SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig();
        mconfig.setRoleServiceName("rs1");
        getSecurityManager().saveSecurityConfig(mconfig);
       
        GeoServerUserGroupService ugservice = createUserGroupService("ug1");
        GeoServerUserGroupStore ugstore = ugservice.createStore();
        GeoServerUser u1 = ugstore.createUserObject(testUserName, testPassword, true);
View Full Code Here

        prepareAuthProviders(prov.getName());       
       
    }
   
    protected void insertAnonymousFilter() throws Exception{
        SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig();
        mconfig.getFilterChain().find(pattern).getFilterNames().add(GeoServerSecurityFilterChain.ANONYMOUS_FILTER);
        getSecurityManager().saveSecurityConfig(mconfig);       
    }
View Full Code Here

        mconfig.getFilterChain().find(pattern).getFilterNames().add(GeoServerSecurityFilterChain.ANONYMOUS_FILTER);
        getSecurityManager().saveSecurityConfig(mconfig);       
    }
   
    protected void removeAnonymousFilter() throws Exception{
        SecurityManagerConfig mconfig = getSecurityManager().loadSecurityConfig();
        mconfig.getFilterChain().find(pattern).getFilterNames()
            .remove(GeoServerSecurityFilterChain.ANONYMOUS_FILTER);
        getSecurityManager().saveSecurityConfig(mconfig);
    }
View Full Code Here

    public void checkForAuthenticatedRole(Authentication auth) {
        assertTrue(auth.getAuthorities().contains(GeoServerRole.AUTHENTICATED_ROLE));
    }

    protected void prepareAuthProviders(String... authProviderNames) throws Exception{
       SecurityManagerConfig config = getSecurityManager().getSecurityConfig();
       config.getAuthProviderNames().clear();
       for (String n : authProviderNames)
           config.getAuthProviderNames().add(n);
       getSecurityManager().saveSecurityConfig(config);
    }
View Full Code Here

           config.getAuthProviderNames().add(n);
       getSecurityManager().saveSecurityConfig(config);
    }

    protected void prepareFilterChain(Class filterChainClass, String pattern, String... filterNames) throws Exception{
        SecurityManagerConfig config = getSecurityManager().getSecurityConfig();
        GeoServerSecurityFilterChain filterChain = config.getFilterChain();

        filterChain.removeForPattern(pattern);

        Constructor<?> cons = filterChainClass.getConstructor(new Class[] {                       
                String[].class });
View Full Code Here

        getSecurityManager().saveSecurityConfig(config);
    }

    protected void modifyChain(String pattern, boolean disabled,boolean allowSessionCreation,String roleFilterName) throws Exception {
        SecurityManagerConfig config = getSecurityManager().getSecurityConfig();
        RequestFilterChain chain = config.getFilterChain().find(pattern);
        chain.setDisabled(disabled);
        chain.setAllowSessionCreation(allowSessionCreation);
        chain.setRoleFilterName(roleFilterName);
       
        getSecurityManager().saveSecurityConfig(config);
View Full Code Here

TOP

Related Classes of org.geoserver.security.config.SecurityManagerConfig

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.