Package org.geoserver.security

Examples of org.geoserver.security.RequestFilterChain


        GeoServerSecurityFilterChain secFilterChain =
            new GeoServerSecurityFilterChain(secMgr.getSecurityConfig().getFilterChain());

        List<Filter> filters = new ArrayList<Filter>();
        for (String chainName : chainNames) {
            RequestFilterChain reqFilterChain = secFilterChain.getRequestChainByName(chainName);
            filters.addAll(Lists.transform(reqFilterChain.getCompiledFilterNames(), new Function<String, Filter>() {
                @Override
                public Filter apply(@Nullable String s) {
                    try {
                        return secMgr.loadFilter(s);
                    } catch (IOException e) {
View Full Code Here


    public void configureFilterChain(GeoServerSecurityFilterChain filterChain) {
       
        if ( filterChain.getRequestChainByName(PROXYRECEPTORCHAIN) != null)
            return;
       
        RequestFilterChain casChain =
            new ConstantFilterChain(GeoServerCasConstants.CAS_PROXY_RECEPTOR_PATTERN,
                    GeoServerCasConstants.CAS_PROXY_RECEPTOR_PATTERN+"/");
        casChain.setFilterNames(pgtCallback.getName());
        casChain.setName(PROXYRECEPTORCHAIN);
        filterChain.getRequestChains().add(0,casChain);
    }
View Full Code Here

        filterChain.removeForPattern(pattern);

        Constructor<?> cons = filterChainClass.getConstructor(new Class[] {                       
                String[].class });
        String[] args= new String[] {pattern};
        RequestFilterChain requestChain = (RequestFilterChain)cons.newInstance(new Object[] {args});       
        requestChain = new HtmlLoginFilterChain(pattern);
        requestChain.setName("testChain");
        requestChain.setFilterNames(filterNames);

        //insert before default
        filterChain.getRequestChains().add(filterChain.getRequestChains().size()-2, requestChain);

        getSecurityManager().saveSecurityConfig(config);
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);
        return;
    }
View Full Code Here

       
        prepareFilterChain(pattern,GeoServerSecurityFilterChain.ANONYMOUS_FILTER);
        modifyChain(pattern, false, true, null);
       
        SecurityManagerConfig secConfig = getSecurityManager().getSecurityConfig();       
        RequestFilterChain chain = secConfig.getFilterChain().getRequestChainByName("testChain");
        chain.setRequireSSL(true);       
        getSecurityManager().saveSecurityConfig(secConfig);
       
        MockHttpServletRequest request= createRequest("/foo/bar?request=getCapabilities&a=b");
        request.setProtocol("https");
        MockHttpServletResponse response= new MockHttpServletResponse();
       
        MockFilterChain authchain = new MockFilterChain();                           
        getProxy().doFilter(request, response, authchain);
        assertEquals(HttpServletResponse.SC_OK, response.getErrorCode());

        request= createRequest("/foo/bar?request=getCapabilities&a=b");       
        response= new MockHttpServletResponse();
       
        authchain = new MockFilterChain();                           
        getProxy().doFilter(request, response, authchain);
        assertTrue(response.wasRedirectSent());
        String urlString = response.getHeader("Location");
        assertNotNull(urlString);
        assertTrue(urlString.startsWith("https"));
        assertTrue(urlString.indexOf("a=b")!=-1);
        assertTrue(urlString.indexOf("443")!=-1);

        chain.setRequireSSL(false);
        getSecurityManager().saveSecurityConfig(secConfig);
       

    }
View Full Code Here

            return new Label(id, property.getModel(itemModel));           
        }
    }
   
    Component removeLink(String id, IModel itemModel) {
        final RequestFilterChain chain = (RequestFilterChain) itemModel.getObject();
       
        if (chain.canBeRemoved()==false) {
            ImageAjaxLink blankLink = new ImageAjaxLink( id, new ResourceReference( getClass(), "../img/icons/blank.png") ) {
                @Override
                protected void onClick(AjaxRequestTarget target) {
                }
            };
View Full Code Here

   
                String chainName=(String)property.getModel(model).getObject();   
                @Override
                protected void onClick(AjaxRequestTarget target) {
                   
                    RequestFilterChain chain = 
                            SecurityFilterChainsPanel.this.secMgrConfig.getFilterChain().getRequestChainByName(chainName);
                   
                    SecurityFilterChainPage editPage=null;
                    if (chain instanceof VariableFilterChain)
                        editPage = new SecurityVariableFilterChainPage(
View Full Code Here

       
    }

    protected void handleSubmit(Form<?> form) {
        RequestFilterChain chain =chainWrapper.getChain();
        try {
            new SecurityConfigValidator(getSecurityManager()).
                validateRequestFilterChain(chainWrapper.getChain());
            if (isNew)
                secMgrConfig.getFilterChain().getRequestChains().add(chain);
View Full Code Here

TOP

Related Classes of org.geoserver.security.RequestFilterChain

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.