Package com.nimbusds.oauth2.sdk.id

Examples of com.nimbusds.oauth2.sdk.id.ClientID


    URI uri = new URI("https://c2id.com/authz/");
    ResponseType rts = new ResponseType();
    rts.add(ResponseType.Value.CODE);

    ClientID clientID = new ClientID("123456");

    URI redirectURI = new URI("https://example.com/oauth2/");

    Scope scope = Scope.parse("read write");
View Full Code Here


    URI uri = new URI("https://c2id.com/authz/");
    ResponseType rts = new ResponseType();
    rts.add(ResponseType.Value.CODE);

    ClientID clientID = new ClientID("123456");

    URI redirectURI = new URI("https://example.com/oauth2/");

    Scope scope = Scope.parse("read write");
View Full Code Here


  public void testBuilderMinimal()
    throws Exception {

    AuthorizationRequest request = new AuthorizationRequest.Builder(new ResponseType("code"), new ClientID("123")).build();

    assertTrue(new ResponseType("code").equals(request.getResponseType()));
    assertTrue(new ClientID("123").equals(request.getClientID()));
    assertNull(request.getEndpointURI());
    assertNull(request.getRedirectionURI());
    assertNull(request.getScope());
    assertNull(request.getState());
  }
View Full Code Here


  public void testBuilderFull()
    throws Exception {

    AuthorizationRequest request = new AuthorizationRequest.Builder(new ResponseType("code"), new ClientID("123")).
      endpointURI(new URI("https://c2id.com/login")).
      redirectionURI(new URI("https://client.com/cb")).
      scope(new Scope("openid", "email")).
      state(new State("123")).
      build();

    assertTrue(new ResponseType("code").equals(request.getResponseType()));
    assertTrue(new ClientID("123").equals(request.getClientID()));
    assertEquals("https://c2id.com/login", request.getEndpointURI().toString());
    assertEquals("https://client.com/cb", request.getRedirectionURI().toString());
    assertTrue(new Scope("openid", "email").equals(request.getScope()));
    assertTrue(new State("123").equals(request.getState()));
  }
View Full Code Here

   
    BearerAccessToken accessToken = BearerAccessToken.parse(httpRequest.getAuthorization());
   
    JSONObject jsonObject = httpRequest.getQueryAsJSONObject();
   
    ClientID id = new ClientID(JSONObjectUtils.getString(jsonObject, "client_id"));

    OIDCClientMetadata metadata = OIDCClientMetadata.parse(jsonObject);
   
    Secret clientSecret = null;
   
View Full Code Here

    // Parse and validate the core OAuth 2.0 autz request params in
    // the context of OIDC
    AuthorizationRequest ar = AuthorizationRequest.parse(uri, params);

    ClientID clientID = ar.getClientID();
    State state = ar.getState();

    // Required in OIDC
    URI redirectURI = ar.getRedirectionURI();
View Full Code Here

   *                        OpenID Connect client information instance.
   */
  public static OIDCClientInformation parse(final JSONObject jsonObject)
    throws ParseException {

    ClientID id = new ClientID(JSONObjectUtils.getString(jsonObject, "client_id"));

    Date issueDate = null;

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

View Full Code Here

            final JWTID jti) {

    if (clientID == null)
      throw new IllegalArgumentException("The client ID must not be null");

    iss = new Issuer(clientID.getValue());

    sub = new Subject(clientID.getValue());

   
    if (aud == null)
View Full Code Here

   */
  public static JWTAuthenticationClaimsSet parse(final JSONObject jsonObject)
    throws ParseException {
   
    // Parse required claims
    Issuer iss = new Issuer(JSONObjectUtils.getString(jsonObject, "iss"));
    Subject sub = new Subject(JSONObjectUtils.getString(jsonObject, "sub"));

    Audience aud;

    if (jsonObject.get("aud") instanceof String) {

      aud = new Audience(JSONObjectUtils.getString(jsonObject, "aud"));

    } else {
      String[] audList = JSONObjectUtils.getStringArray(jsonObject, "aud");

      if (audList.length > 1)
        throw new ParseException("Multiple audiences (aud) not supported");

      aud = new Audience(audList[0]);
    }

    Date exp = DateUtils.fromSecondsSinceEpoch(JSONObjectUtils.getLong(jsonObject, "exp"));


    // Parse optional claims

    Date nbf = null;

    if (jsonObject.containsKey("nbf"))
      nbf = DateUtils.fromSecondsSinceEpoch(JSONObjectUtils.getLong(jsonObject, "nbf"));

    Date iat = null;

    if (jsonObject.containsKey("iat"))
      iat = DateUtils.fromSecondsSinceEpoch(JSONObjectUtils.getLong(jsonObject, "iat"));

    JWTID jti = null;

    if (jsonObject.containsKey("jti"))
      jti = new JWTID(JSONObjectUtils.getString(jsonObject, "jti"));


    // Check client ID

    if (! iss.getValue().equals(sub.getValue()))
      throw new ParseException("JWT issuer and subject must have the same client ID");

    ClientID clientID = new ClientID(iss.getValue());

    return new JWTAuthenticationClaimsSet(clientID, aud, exp, nbf, iat, jti);
  }
View Full Code Here

    Date iat = null;

    if (jsonObject.containsKey("iat"))
      iat = DateUtils.fromSecondsSinceEpoch(JSONObjectUtils.getLong(jsonObject, "iat"));

    JWTID jti = null;

    if (jsonObject.containsKey("jti"))
      jti = new JWTID(JSONObjectUtils.getString(jsonObject, "jti"));


    // Check client ID

    if (! iss.getValue().equals(sub.getValue()))
View Full Code Here

TOP

Related Classes of com.nimbusds.oauth2.sdk.id.ClientID

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.