Examples of RedirectMismatchException


Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

    for (String redirectUri : redirectUris) {
      if (requestedRedirect != null && redirectMatches(requestedRedirect, redirectUri)) {
        return requestedRedirect;
      }
    }
    throw new RedirectMismatchException("Invalid redirect: " + requestedRedirect
        + " does not match one of the registered values: " + redirectUris.toString());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

    String redirectUriApprovalParameter = pendingOAuth2Request.getRequestParameters().get(
        OAuth2Utils.REDIRECT_URI);

    if ((redirectUri != null || redirectUriApprovalParameter != null)
        && !pendingOAuth2Request.getRedirectUri().equals(redirectUri)) {
      throw new RedirectMismatchException("Redirect URI mismatch.");
    }

    String pendingClientId = pendingOAuth2Request.getClientId();
    String clientId = tokenRequest.getClientId();
    if (clientId != null && !clientId.equals(pendingClientId)) {
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

      // The resolved redirect URI is either the redirect_uri from the parameters or the one from
      // clientDetails. Either way we need to store it on the AuthorizationRequest.
      String redirectUriParameter = authorizationRequest.getRequestParameters().get(OAuth2Utils.REDIRECT_URI);
      String resolvedRedirect = redirectResolver.resolveRedirect(redirectUriParameter, client);
      if (!StringUtils.hasText(resolvedRedirect)) {
        throw new RedirectMismatchException(
            "A redirectUri must be either supplied or preconfigured in the ClientDetails");
      }
      authorizationRequest.setRedirectUri(resolvedRedirect);

      // We intentionally only validate the parameters requested by the client (ignoring any data that may have
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

    assertEquals(expected, getOutput());
  }

  @Test
  public void writeRedirectUriMismatch() throws Exception {
    OAuth2Exception oauthException = new RedirectMismatchException(DETAILS);
    String expected = createResponse(oauthException.getOAuth2ErrorCode());
    converter.write(oauthException, contentType, outputMessage);
    assertEquals(expected, getOutput());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

  @Test
  public void readRedirectUriMismatch() throws Exception {
    String accessToken = createResponse(OAuth2Exception.REDIRECT_URI_MISMATCH);
    when(inputMessage.getBody()).thenReturn(createInputStream(accessToken));
    @SuppressWarnings("unused")
    RedirectMismatchException result = (RedirectMismatchException) converter.read(OAuth2Exception.class,
        inputMessage);
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

  }

  @Test
  public void readValueRedirectUriMismatch() throws Exception {
    String accessToken = createResponse(OAuth2Exception.INVALID_GRANT, "Redirect URI mismatch.");
    RedirectMismatchException result = (RedirectMismatchException) mapper.readValue(accessToken,
        OAuth2Exception.class);
    assertEquals("Redirect URI mismatch.",result.getMessage());
    assertEquals(null,result.getAdditionalInformation());
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

    assertEquals(expected,mapper.writeValueAsString(oauthException));
  }

  @Test
  public void writeValueAsStringRedirectUriMismatch() throws Exception {
    oauthException = new RedirectMismatchException(DETAILS);
    String expected = createResponse(oauthException.getOAuth2ErrorCode());
    assertEquals(expected,mapper.writeValueAsString(oauthException));
  }
View Full Code Here

Examples of org.springframework.security.oauth2.common.exceptions.RedirectMismatchException

  }

  @Test
  public void readValueRedirectUriMismatch() throws Exception {
    String accessToken = createResponse(OAuth2Exception.INVALID_GRANT, "Redirect URI mismatch.");
    RedirectMismatchException result = (RedirectMismatchException) mapper.readValue(accessToken,
        OAuth2Exception.class);
    assertEquals("Redirect URI mismatch.",result.getMessage());
    assertEquals(null,result.getAdditionalInformation());
  }
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.