Package com.nimbusds.oauth2.sdk.id

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


    throws Exception {

    GeneralException e = new GeneralException(
      "message",
      OAuth2Error.INVALID_REQUEST,
      new ClientID("abc"),
      new URI("https://redirect.com"),
      new State("123"),
      new IllegalArgumentException());

    assertEquals("message", e.getMessage());
View Full Code Here



  public void testCycle()
    throws Exception {

    ClientID id = new ClientID("123");
    Date issueDate = new Date(new Date().getTime() / 1000 * 1000);
    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/cb"));
    metadata.applyDefaults();
    Secret secret = new Secret();
    BearerAccessToken accessToken = new BearerAccessToken();
    URI uri = new URI("https://c2id.com/client-reg/123");

    OIDCClientInformation info = new OIDCClientInformation(
      id, issueDate, metadata, secret, uri, accessToken);

    OIDCClientInformationResponse response = new OIDCClientInformationResponse(info);

    assertEquals(info, response.getOIDCClientInformation());
    assertEquals(info, response.getClientInformation());

    HTTPResponse httpResponse = response.toHTTPResponse();

    response = OIDCClientInformationResponse.parse(httpResponse);

    assertEquals(id.getValue(), response.getClientInformation().getID().getValue());
    assertEquals(issueDate, response.getClientInformation().getIDIssueDate());
    assertEquals("https://client.com/cb", response.getClientInformation().getMetadata().getRedirectionURIs().iterator().next().toString());
    assertEquals(secret.getValue(), response.getClientInformation().getSecret().getValue());
    assertEquals(uri.toString(), response.getClientInformation().getRegistrationURI().toString());
    assertEquals(accessToken.getValue(), response.getClientInformation().getRegistrationAccessToken().getValue());
View Full Code Here

  public void testCycle()
    throws Exception {

    URI uri = new URI("https://c2id.com/client-reg/123");
    ClientID clientID = new ClientID("123");
    BearerAccessToken accessToken = new BearerAccessToken();
    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/cb"));
    metadata.setName("My app");
    metadata.applyDefaults();
    Secret secret = new Secret();

    OIDCClientUpdateRequest request = new OIDCClientUpdateRequest(
      uri,
      clientID,
      accessToken,
      metadata,
      secret);

    assertEquals(uri, request.getEndpointURI());
    assertEquals(clientID, request.getClientID());
    assertEquals(accessToken, request.getAccessToken());
    assertEquals(metadata, request.getOIDCClientMetadata());
    assertEquals(metadata, request.getClientMetadata());
    assertEquals(secret, request.getClientSecret());


    HTTPRequest httpRequest = request.toHTTPRequest();

    request = OIDCClientUpdateRequest.parse(httpRequest);

    assertEquals(uri.toString(), request.getEndpointURI().toString());
    assertEquals(clientID.getValue(), request.getClientID().getValue());
    assertEquals(accessToken.getValue(), request.getAccessToken().getValue());
    assertEquals("https://client.com/cb", request.getClientMetadata().getRedirectionURIs().iterator().next().toString());
    assertEquals("My app", request.getClientMetadata().getName());
    assertEquals(secret.getValue(), request.getClientSecret().getValue());
  }
View Full Code Here


  public void testConstructor()
    throws Exception {

    ClientID clientID = new ClientID("123");
    Date now = new Date(new Date().getTime() / 1000 * 1000);
    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setName("Example app");
    Secret secret = new Secret("secret");
    URI regURI = new URI("https://c2id.com/client-reg/123");
View Full Code Here


  public void testMinimalConstructor()
    throws Exception {

    ClientID clientID = new ClientID("123");
    ClientMetadata metadata = new ClientMetadata();
    metadata.setName("Example app");

    ClientInformation info = new ClientInformation(clientID, null, metadata, null);
View Full Code Here


  public void testFullConstructor()
    throws Exception {

    ClientID clientID = new ClientID("123");
    ClientMetadata metadata = new ClientMetadata();
    metadata.setName("Example app");

    ClientInformation info = new ClientInformation(clientID, null, metadata, null, null, null);
View Full Code Here


  public void testNoSecretExpiration()
    throws Exception {

    ClientID clientID = new ClientID("123");
    ClientMetadata metadata = new ClientMetadata();
    metadata.setRedirectionURI(new URI("https://example.com/in"));
    Secret secret = new Secret("secret");

    ClientInformation clientInfo = new ClientInformation(clientID, null, metadata, secret);
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");

    AuthorizationRequest req = new AuthorizationRequest(uri, rts, clientID);

    assertEquals(uri, req.getEndpointURI());
    assertEquals(rts, req.getResponseType());
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");

    AuthorizationRequest req = new AuthorizationRequest(uri, rts, clientID);

    String query = req.toQueryString();
View Full Code Here

  public void testToRequestURIWithParse()
    throws Exception {

    URI redirectURI = new URI("https://client.com/cb");
    ResponseType rts = new ResponseType("code");
    ClientID clientID = new ClientID("123456");
    URI endpointURI = new URI("https://c2id.com/login");

    AuthorizationRequest req = new AuthorizationRequest.Builder(rts, clientID).
      redirectionURI(redirectURI).
      endpointURI(endpointURI).
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.