Package org.springframework.security.web.savedrequest

Examples of org.springframework.security.web.savedrequest.DefaultSavedRequest


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


    // SEC-308, SEC-315
    @Test
    public void headersAreCaseInsensitive() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("USER-aGenT", "Mozilla");
        DefaultSavedRequest saved = new DefaultSavedRequest(request, new MockPortResolver(8080, 8443));
        assertEquals("Mozilla", saved.getHeaderValues("user-agent").get(0));
    }
View Full Code Here

    // SEC-1412
    @Test
    public void discardsIfNoneMatchHeader() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addHeader("If-None-Match", "somehashvalue");
        DefaultSavedRequest saved = new DefaultSavedRequest(request, new MockPortResolver(8080, 8443));
        assertTrue(saved.getHeaderValues("if-none-match").isEmpty());
    }
View Full Code Here

    // TODO: Why are parameters case insensitive. I think this is a mistake
    @Test
    public void parametersAreCaseInsensitive() throws Exception {
        MockHttpServletRequest request = new MockHttpServletRequest();
        request.addParameter("ThisIsATest", "Hi mom");
        DefaultSavedRequest saved = new DefaultSavedRequest(request, new MockPortResolver(8080, 8443));
        assertEquals("Hi mom", saved.getParameterValues("thisisatest")[0]);
    }
View Full Code Here

   *
   * @param request The request.
   * @return The callback URL.
   */
  protected String getCallbackURL(HttpServletRequest request) {
    return new DefaultSavedRequest(request, getPortResolver()).getRedirectUrl();
  }
View Full Code Here

        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

   * @param response HTTP response
   */
  @Override
  public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
    if (requestMatcher.matches(request)) {
      DefaultSavedRequest savedRequest = new DefaultSavedRequest(request, portResolver);
      Utils.setStateParam(Config.RETURNTO_COOKIE,
          Utils.base64enc(savedRequest.getRedirectUrl().getBytes()), request, response);
    }
  }
View Full Code Here

    protected final String savedRequestKey = "lightadmin:SPRING_SECURITY_SAVED_REQUEST";
    protected final PortResolver portResolver = new PortResolverImpl();

    @Override
    public void saveRequest(HttpServletRequest request, HttpServletResponse response) {
        DefaultSavedRequest savedRequest = new DefaultSavedRequest(request, portResolver);
        request.getSession().setAttribute(savedRequestKey, savedRequest);
        logger.debug("DefaultSavedRequest added to Session: " + savedRequest);
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.web.savedrequest.DefaultSavedRequest

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.