Package com.nimbusds.oauth2.sdk

Examples of com.nimbusds.oauth2.sdk.ParseException


    try {
      return JWTClaimsSet.parse(claims);

    } catch (java.text.ParseException e) {

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


    try {
      return new Address(jsonObject);

    } catch (IllegalArgumentException e) {

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

      op.tokenEndpointJWSAlgs = new ArrayList<>();
     
      for (String v: JSONObjectUtils.getStringArray(jsonObject, "token_endpoint_auth_signing_alg_values_supported")) {

        if (v != null && v.equals(Algorithm.NONE.getName()))
          throw new ParseException("The none algorithm is not accepted");
       
        if (v != null)
          op.tokenEndpointJWSAlgs.add(new JWSAlgorithm(v));
      }
    }
   
   
    // OpenID Connect request object

    if (jsonObject.containsKey("request_object_signing_alg_values_supported")) {

      op.requestObjectJWSAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "request_object_signing_alg_values_supported")) {

        if (v != null)
          op.requestObjectJWSAlgs.add(new JWSAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("request_object_encryption_alg_values_supported")) {

      op.requestObjectJWEAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "request_object_encryption_alg_values_supported")) {

        if (v != null)
          op.requestObjectJWEAlgs.add(new JWEAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("request_object_encryption_enc_values_supported")) {

      op.requestObjectJWEEncs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "request_object_encryption_enc_values_supported")) {

        if (v != null)
          op.requestObjectJWEEncs.add(new EncryptionMethod(v));
      }
    }
   
   
    // ID token

    if (jsonObject.containsKey("id_token_signing_alg_values_supported")) {

      op.idTokenJWSAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "id_token_signing_alg_values_supported")) {

        if (v != null)
          op.idTokenJWSAlgs.add(new JWSAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("id_token_encryption_alg_values_supported")) {

      op.idTokenJWEAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "id_token_encryption_alg_values_supported")) {

        if (v != null)
          op.idTokenJWEAlgs.add(new JWEAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("id_token_encryption_enc_values_supported")) {

      op.idTokenJWEEncs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "id_token_encryption_enc_values_supported")) {

        if (v != null)
          op.idTokenJWEEncs.add(new EncryptionMethod(v));
      }
    }

    // UserInfo

    if (jsonObject.containsKey("userinfo_signing_alg_values_supported")) {

      op.userInfoJWSAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "userinfo_signing_alg_values_supported")) {

        if (v != null)
          op.userInfoJWSAlgs.add(new JWSAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("userinfo_encryption_alg_values_supported")) {

      op.userInfoJWEAlgs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "userinfo_encryption_alg_values_supported")) {

        if (v != null)
          op.userInfoJWEAlgs.add(new JWEAlgorithm(v));
      }
    }


    if (jsonObject.containsKey("userinfo_encryption_enc_values_supported")) {

      op.userInfoJWEEncs = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "userinfo_encryption_enc_values_supported")) {

          if (v != null)
            op.userInfoJWEEncs.add(new EncryptionMethod(v));
      }
    }

   
    // Misc

    if (jsonObject.containsKey("display_values_supported")) {

      op.displays = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "display_values_supported")) {

        if (v != null)
          op.displays.add(Display.parse(v));
      }
    }
   
    if (jsonObject.containsKey("claim_types_supported")) {
     
      op.claimTypes = new ArrayList<>();
     
      for (String v: JSONObjectUtils.getStringArray(jsonObject, "claim_types_supported")) {
       
        if (v != null)
          op.claimTypes.add(ClaimType.parse(v));
      }
    }


    if (jsonObject.containsKey("claims_supported")) {

      op.claims = new ArrayList<>();

      for (String v: JSONObjectUtils.getStringArray(jsonObject, "claims_supported")) {

        if (v != null)
          op.claims.add(v);
      }
    }
   
    if (jsonObject.containsKey("claims_locales_supported")) {
     
      op.claimsLocales = new ArrayList<>();
     
      for (String v : JSONObjectUtils.getStringArray(jsonObject, "claims_locales_supported")) {
       
        if (v != null) {
         
          try {
            op.claimsLocales.add(LangTag.parse(v));
         
          } catch (LangTagException e) {
           
            throw new ParseException("Invalid claims_locales_supported field: " + e.getMessage(), e);
          }
        }
      }
    }
   
    if (jsonObject.containsKey("ui_locales_supported")) {
     
      op.uiLocales = new ArrayList<>();
     
      for (String v : JSONObjectUtils.getStringArray(jsonObject, "ui_locales_supported")) {
       
        if (v != null) {
         
          try {
            op.uiLocales.add(LangTag.parse(v));
         
          } catch (LangTagException e) {
           
            throw new ParseException("Invalid ui_locales_supported field: " + e.getMessage(), e);
          }
        }
      }
    }
View Full Code Here

    throws ParseException {

    super(jsonObject);

    if (getStringClaim(ISS_CLAIM_NAME) == null)
      throw new ParseException("Missing or invalid \"iss\" claim");

    if (getStringClaim(SUB_CLAIM_NAME) == null)
      throw new ParseException("Missing or invalid \"sub\" claim");

    if (getStringClaim(AUD_CLAIM_NAME) == null && getStringListClaim(AUD_CLAIM_NAME) == null ||
        getStringListClaim(AUD_CLAIM_NAME) != null && getStringListClaim(AUD_CLAIM_NAME).isEmpty())
      throw new ParseException("Missing or invalid \"aud\" claim");

    if (getDateClaim(EXP_CLAIM_NAME) == null)
      throw new ParseException("Missing or invalid \"exp\" claim");

    if (getDateClaim(IAT_CLAIM_NAME) == null)
      throw new ParseException("Missing or invalid \"iat\" claim");
  }
View Full Code Here

    try {
      return new IDTokenClaimsSet(jsonObject);

    } catch (IllegalArgumentException e) {

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

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

    } catch (URISyntaxException e) {

      throw new ParseException(e.getMessage(), e);
    }
   
    return new OIDCClientUpdateRequest(endpointURI, id, accessToken, metadata, clientSecret);
  }
View Full Code Here

      try {
        idToken = JWTParser.parse(JSONObjectUtils.getString(jsonObject, "id_token"));
       
      } catch (java.text.ParseException e) {
     
        throw new ParseException("Couldn't parse ID token: " + e.getMessage(), e);
      }
    }

    // Parse the custom parameters
    Map<String,Object> customParams = new HashMap<>();
View Full Code Here

      try {
        idToken = JWTParser.parse(params.get("id_token"));
       
      } catch (java.text.ParseException e) {
     
        throw new ParseException("Invalid ID Token JWT: " + e.getMessage(), e);
      }
    }

    return new AuthenticationSuccessResponse(redirectURI,
                                          asr.getAuthorizationCode(),
View Full Code Here

    } else if (uri.getRawFragment() != null) {

      paramString = uri.getRawFragment();
   
    } else {
      throw new ParseException("Missing authorization response parameters");
    }
   
    Map<String,String> params = URLUtils.parseParameters(paramString);

    if (params == null) {
      throw new ParseException("Missing or invalid authorization response parameters");
    }

    return parse(URIUtils.getBaseURI(uri), params);
  }
View Full Code Here

   */
  public static AuthenticationSuccessResponse parse(final HTTPResponse httpResponse)
    throws ParseException {
   
    if (httpResponse.getStatusCode() != HTTPResponse.SC_FOUND)
      throw new ParseException("Unexpected HTTP status code, must be 302 (Found): " +
                               httpResponse.getStatusCode());
   
    URI location = httpResponse.getLocation();
   
    if (location == null)
      throw new ParseException("Missing redirection URI / HTTP Location header");

    return parse(location);
  }
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.