Package org.springframework.security.web

Examples of org.springframework.security.web.RedirectStrategy


    }

    @Test
    public void onAuthenticationSuccessHasSavedRequest() throws Exception {
        String redirectUrl = "http://localhost/appcontext/page";
        RedirectStrategy redirectStrategy = mock(RedirectStrategy.class);
        RequestCache requestCache = mock(RequestCache.class);
        SavedRequest savedRequest = mock(SavedRequest.class);
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
        when(savedRequest.getRedirectUrl()).thenReturn(redirectUrl);
View Full Code Here


public class SimpleUrlAuthenticationFailureHandlerTests {

    @Test
    public void error401IsReturnedIfNoUrlIsSet() throws Exception {
        SimpleUrlAuthenticationFailureHandler afh = new SimpleUrlAuthenticationFailureHandler();
        RedirectStrategy rs = mock(RedirectStrategy.class);
        afh.setRedirectStrategy(rs);
        assertSame(rs, afh.getRedirectStrategy());
        MockHttpServletRequest request = new MockHttpServletRequest();
        MockHttpServletResponse response = new MockHttpServletResponse();
View Full Code Here

    public void testGettersSetters() {
        RetryWithHttpEntryPoint ep = new RetryWithHttpEntryPoint();
        PortMapper portMapper = mock(PortMapper.class);
        PortResolver portResolver = mock(PortResolver.class);
        RedirectStrategy redirector = mock(RedirectStrategy.class);
        ep.setPortMapper(portMapper);
        ep.setPortResolver(portResolver);
        ep.setRedirectStrategy(redirector);
        assertSame(portMapper, ep.getPortMapper());
        assertSame(portResolver, ep.getPortResolver());
View Full Code Here

  public void testAuthenticationSuccess() throws Exception {

    UserAuthorizationSuccessfulAuthenticationHandler handler = new UserAuthorizationSuccessfulAuthenticationHandler();
    HttpServletRequest request = mock(HttpServletRequest.class);
    HttpServletResponse response = mock(HttpServletResponse.class);
    RedirectStrategy redirectStrategy = mock(RedirectStrategy.class);
    handler.setRedirectStrategy(redirectStrategy);

    when(request.getAttribute(UserAuthorizationProcessingFilter.CALLBACK_ATTRIBUTE)).thenReturn(
        "http://my.host.com/my/context");
    when(request.getAttribute(UserAuthorizationProcessingFilter.VERIFIER_ATTRIBUTE)).thenReturn("myver");
View Full Code Here

      protected String getUserAuthorizationRedirectURL(ProtectedResourceDetails details,
          OAuthConsumerToken requestToken, String callbackURL) {
        return callbackURL + "&" + requestToken.getResourceId();
      }
    };
    filter.setRedirectStrategy(new RedirectStrategy() {
      public void sendRedirect(HttpServletRequest request, HttpServletResponse response, String url)
          throws IOException {
        response.sendRedirect(url);
      }
    });
View Full Code Here

        Authentication auth = new TestingAuthenticationToken(user, null);

        AuthenticationException exception = new BadCredentialsException("Password doesn't match!");
        exception.setAuthentication(auth);

        RedirectStrategy redirectStrategy = mock(RedirectStrategy.class);
        handler.setRedirectStrategy(redirectStrategy);
        handler.setDefaultFailureUrl("/badlogin?login_error=1");
        handler.setUsernameSessionAttribute("j_user_name");

        HttpServletRequest request = new MockHttpServletRequest();
View Full Code Here

    }

    @Test
    public void shouldRedirectToDefaultTargetUrlWhenNoOpenIdRequestGiven() throws Exception {
        OpenIdAuthenticationSuccessHandler handler = new OpenIdAuthenticationSuccessHandler(openIdManagerMock);
        RedirectStrategy strategyMock = Mockito.mock(RedirectStrategy.class);
        handler.setDefaultTargetUrl("/loginFailed.html");
        handler.setRedirectStrategy(strategyMock);
        when(openIdManagerMock.isOpenIdRequest(requestMock)).thenReturn(false);

        handler.onAuthenticationSuccess(requestMock, responseMock, authenticationMock);
View Full Code Here

TOP

Related Classes of org.springframework.security.web.RedirectStrategy

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.