Examples of OAuth2Exception


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

    assertEquals(expected, getOutput());
  }

  @Test
  public void writeAccessDenied() throws Exception {
    OAuth2Exception oauthException = new UserDeniedAuthorizationException(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.OAuth2Exception

    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.OAuth2Exception

    assertEquals(expected, getOutput());
  }

  @Test
  public void writeInvalidToken() throws Exception {
    OAuth2Exception oauthException = new InvalidTokenException(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.OAuth2Exception

    assertEquals(expected, getOutput());
  }

  @Test
  public void writeOAuth2Exception() throws Exception {
    OAuth2Exception oauthException = new OAuth2Exception(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.OAuth2Exception

  }

  @Test
  public void testExceptionDeserialization() throws Exception {
    String exception = "{\"error\": \"invalid_client\", \"error_description\": \"FOO\", \"foo\": \"bar\"}";
    OAuth2Exception result = new ObjectMapper().readValue(exception, OAuth2Exception.class);
    // System.err.println(result);
    assertEquals("FOO", result.getMessage());
    assertEquals("invalid_client", result.getOAuth2ErrorCode());
    assertEquals("{foo=bar}", result.getAdditionalInformation().toString());
    assertTrue(result instanceof InvalidClientException);
  }
View Full Code Here

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

  // SECOAUTH-311
  @Test
  public void writeCreatesNewUnmarshaller() throws Exception {
    useMockJAXBContext(converter, JaxbOAuth2Exception.class);
    OAuth2Exception oauthException = new OAuth2Exception(DETAILS);

    converter.write(oauthException, contentType, outputMessage);
    verify(context).createMarshaller();

    converter.write(oauthException, contentType, outputMessage);
View Full Code Here

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

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

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

  @Test
  public void testExceptionDeserialization() throws Exception {
    Map<String, String> exception = MapBuilder.create("error", "invalid_client").add("error_description", "FOO")
        .build();
    OAuth2Exception result = OAuth2Exception.valueOf(exception);
    // System.err.println(result);
    assertEquals("FOO", result.getMessage());
    assertEquals("invalid_client", result.getOAuth2ErrorCode());
    assertTrue(result instanceof InvalidClientException);
  }
View Full Code Here

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

  }

  @Test
  public void readValueUndefinedException() throws Exception {
    String accessToken = createResponse("notdefinedcode");
    OAuth2Exception result = mapper.readValue(accessToken, OAuth2Exception.class);
    assertEquals(DETAILS,result.getMessage());
    assertEquals(null,result.getAdditionalInformation());
  }
View Full Code Here

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

  }

  @Test
  public void readValueWithObjects() throws Exception {
    String accessToken = "{\"error\": [\"invalid\",\"client\"], \"error_description\": {\"some\":\"detail\"}, \"foo\": [\"bar\"]}";
    OAuth2Exception result = mapper.readValue(accessToken, OAuth2Exception.class);
    assertEquals("{some=detail}",result.getMessage());
    assertEquals("{foo=[bar]}",result.getAdditionalInformation().toString());
  }
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.