Package com.nimbusds.oauth2.sdk

Examples of com.nimbusds.oauth2.sdk.ParseException


    try {
      return JWTParser.parse(content);
     
    } catch (java.text.ParseException e) {
   
      throw new ParseException(e.getMessage(), e);
    }
  }
View Full Code Here


    try {
      return new URI(getGeneric(o, key, String.class));

    } catch (URISyntaxException e) {

      throw new ParseException(e.getMessage(), e);
    }
  }
View Full Code Here

    try {
      return new URL(getGeneric(o, key, String.class));
     
    } catch (MalformedURLException e) {
   
      throw new ParseException(e.getMessage(), e);
    }
  }
View Full Code Here

     
      return new InternetAddress(getGeneric(o, key, String.class), strict);
     
    } catch (AddressException e) {
   
      throw new ParseException(e.getMessage(), e);
    }
  }
View Full Code Here

    try {
      return list.toArray(new String[0]);

    } catch (ArrayStoreException e) {

      throw new ParseException("JSON object member with key \"" + key + "\" is not an array of strings");
    }
  }
View Full Code Here

      try {
        set.add((String)item);

      } catch (Exception e) {

        throw new ParseException("JSON object member wit key \"" + key + "\" is not an array of strings");
      }

    }

    return set;
View Full Code Here

   */
  public static void ensureContentType(final ContentType expected, final ContentType found)
    throws ParseException {
 
    if (found == null)
      throw new ParseException("Missing HTTP Content-Type header");
   
    if (! expected.match(found))
      throw new ParseException("The HTTP Content-Type header must be " + expected);
  }
View Full Code Here

    try {
      endpointURI = httpRequest.getURL().toURI();

    } catch (URISyntaxException e) {

      throw new ParseException(e.getMessage(), e);
    }
   
    return new ClientDeleteRequest(endpointURI, accessToken);
  }
View Full Code Here

    // Parse and verify type
    AccessTokenType tokenType = new AccessTokenType(JSONObjectUtils.getString(jsonObject, "token_type"));
   
    if (! tokenType.equals(AccessTokenType.BEARER))
      throw new ParseException("Token type must be \"Bearer\"");
   

    // Parse value
    String accessTokenValue = JSONObjectUtils.getString(jsonObject, "access_token");
   

    // Parse lifetime
    long lifetime = 0;
   
    if (jsonObject.containsKey("expires_in")) {

      // Lifetime can be a JSON number or string

      if (jsonObject.get("expires_in") instanceof Number) {

        lifetime = JSONObjectUtils.getLong(jsonObject, "expires_in");
      }
      else {
        String lifetimeStr = JSONObjectUtils.getString(jsonObject, "expires_in");

        try {
          lifetime = new Long(lifetimeStr);

        } catch (NumberFormatException e) {

          throw new ParseException("Invalid \"expires_in\" parameter, must be integer");
        }
      }
    }

View Full Code Here

   */
  public static BearerAccessToken parse(final String header)
    throws ParseException {

    if (StringUtils.isBlank(header))
      throw new ParseException("Missing HTTP Authorization header", BearerTokenError.MISSING_TOKEN);
 
    String[] parts = header.split("\\s", 2);
 
    if (parts.length != 2)
      throw new ParseException("Invalid HTTP Authorization header value", BearerTokenError.INVALID_REQUEST);
   
    if (! parts[0].equals("Bearer"))
      throw new ParseException("Token type must be \"Bearer\"", BearerTokenError.INVALID_REQUEST);
   
    try {
      return new BearerAccessToken(parts[1]);
     
    } catch (IllegalArgumentException e) {
   
      throw new ParseException(e.getMessage(), BearerTokenError.INVALID_REQUEST);
    }
  }
View Full Code Here

TOP

Related Classes of com.nimbusds.oauth2.sdk.ParseException

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.