Examples of OAuth2Exception


Examples of org.apache.shindig.social.core.oauth2.OAuth2Exception

  private void throwAccessDenied(String msg) throws OAuth2Exception {
    OAuth2NormalizedResponse resp = new OAuth2NormalizedResponse();
    resp.setError(ErrorType.ACCESS_DENIED.toString());
    resp.setErrorDescription(msg);
    resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
    throw new OAuth2Exception(resp);
  }
View Full Code Here

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

      try {
        HttpMessageConverterExtractor<OAuth2Exception> extractor = new HttpMessageConverterExtractor<OAuth2Exception>(
            OAuth2Exception.class, messageConverters);
        try {
          OAuth2Exception body = extractor.extractData(bufferedResponse);
          if (body != null) {
            // If we can get an OAuth2Exception already from the body, it is likely to have more information than
            // the header does, so just re-throw it here.
            throw body;
          }
View Full Code Here

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

    headerType = headerType.toLowerCase();
    if (authenticateHeader.toLowerCase().startsWith(headerType)) {
      Map<String, String> headerEntries = StringSplitUtils.splitEachArrayElementAndCreateMap(
          StringSplitUtils.splitIgnoringQuotes(authenticateHeader.substring(headerType.length()), ','), "=",
          "\"");
      OAuth2Exception ex = OAuth2Exception.valueOf(headerEntries);
      if (ex instanceof InvalidTokenException) {
        // Special case: an invalid token can be renewed so tell the caller what to do
        throw new AccessTokenRequiredException(resource);
      }
      throw ex;
View Full Code Here

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

    @SuppressWarnings("unchecked")
    @Override
    public void handleError(ClientHttpResponse response) throws IOException {
      for (HttpMessageConverter<?> converter : messageConverters) {
        if (converter.canRead(OAuth2Exception.class, response.getHeaders().getContentType())) {
          OAuth2Exception ex;
          try {
            ex = ((HttpMessageConverter<OAuth2Exception>) converter).read(OAuth2Exception.class, response);
          }
          catch (Exception e) {
            // ignore
View Full Code Here

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

    converter = new JaxbOAuth2ExceptionMessageConverter();
  }

  @Test
  public void writeInvalidClient() throws IOException {
    OAuth2Exception oauthException = new InvalidClientException(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 writeInvalidGrant() throws Exception {
    OAuth2Exception oauthException = new InvalidGrantException(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 writeInvalidRequest() throws Exception {
    OAuth2Exception oauthException = new InvalidRequestException(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 writeInvalidScope() throws Exception {
    OAuth2Exception oauthException = new InvalidScopeException(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 writeUnsupportedGrantType() throws Exception {
    OAuth2Exception oauthException = new UnsupportedGrantTypeException(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 writeUnauthorizedClient() throws Exception {
    OAuth2Exception oauthException = new UnauthorizedUserException(DETAILS);
    String expected = createResponse(oauthException.getOAuth2ErrorCode());
    converter.write(oauthException, contentType, outputMessage);
    assertEquals(expected, getOutput());
  }
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.