Examples of PortResolverImpl


Examples of org.springframework.security.util.PortResolverImpl

    private SavedRequest getSavedRequest(ServletRequest request) {
        HttpServletRequest httpRequest = (HttpServletRequest) request;
       
        HttpSession httpSession = httpRequest.getSession(false);
        if (httpSession == null) {
            return new SavedRequest(httpRequest, new PortResolverImpl());
        } else {
            return (SavedRequest) httpSession.getAttribute(AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY);
        }
       
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

import org.springframework.security.web.savedrequest.SavedRequestAwareWrapper;

public class SavedRequestAwareWrapperTests {

    private SavedRequestAwareWrapper createWrapper(MockHttpServletRequest requestToSave, MockHttpServletRequest requestToWrap) {
        DefaultSavedRequest saved = new DefaultSavedRequest(requestToSave, new PortResolverImpl());
        return new SavedRequestAwareWrapper(saved, requestToWrap);
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

    public final void setUp() throws Exception {
        super.setUp();
    }

    public void testDetectsBuggyIeHttpRequest() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setServerPort(8443);
        request.setScheme("HTtP"); // proves case insensitive handling
        assertEquals(8080, pr.getServerPort(request));
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

        request.setScheme("HTtP"); // proves case insensitive handling
        assertEquals(8080, pr.getServerPort(request));
    }

    public void testDetectsBuggyIeHttpsRequest() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setServerPort(8080);
        request.setScheme("HTtPs"); // proves case insensitive handling
        assertEquals(8443, pr.getServerPort(request));
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

        request.setScheme("HTtPs"); // proves case insensitive handling
        assertEquals(8443, pr.getServerPort(request));
    }

    public void testDetectsEmptyPortMapper() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();

        try {
            pr.setPortMapper(null);
            fail("Should have thrown IllegalArgumentException");
        } catch (IllegalArgumentException expected) {
            assertTrue(true);
        }
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

            assertTrue(true);
        }
    }

    public void testGettersSetters() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();
        assertTrue(pr.getPortMapper() != null);
        pr.setPortMapper(new PortMapperImpl());
        assertTrue(pr.getPortMapper() != null);
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

        pr.setPortMapper(new PortMapperImpl());
        assertTrue(pr.getPortMapper() != null);
    }

    public void testNormalOperation() throws Exception {
        PortResolverImpl pr = new PortResolverImpl();

        MockHttpServletRequest request = new MockHttpServletRequest();
        request.setScheme("http");
        request.setServerPort(1021);
        assertEquals(1021, pr.getServerPort(request));
    }
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

        HttpSessionRequestCache cache = new HttpSessionRequestCache() {

            @Override
            public void saveRequest(HttpServletRequest request,
                    HttpServletResponse response) {
                request.getSession().setAttribute(SAVED_REQUEST, new CustomSavedRequest(new DefaultSavedRequest(request, new PortResolverImpl())));
            }

        };
        cache.saveRequest(request,response);
View Full Code Here

Examples of org.springframework.security.web.PortResolverImpl

        Authentication auth = getSession().getAuthentication();
        if(auth == null || !auth.isAuthenticated() || auth instanceof AnonymousAuthenticationToken) {
            // emulate what spring security url control would do so that we get a proper redirect after login
            HttpServletRequest httpRequest = ((WebRequest) getRequest()).getHttpServletRequest();
            //ExceptionTranslationFilter translator = (ExceptionTranslationFilter) getGeoServerApplication().getBean("consoleExceptionTranslationFilter");
            SavedRequest savedRequest = new DefaultSavedRequest(httpRequest, new PortResolverImpl());
           
            HttpSession session = httpRequest.getSession();
            // TODO, Justin, WebAttributes.SAVED_REQUEST has disappeared in spring security framework
            session.setAttribute(SAVED_REQUEST, savedRequest);
           
View Full Code Here
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.