Package com.nimbusds.oauth2.sdk.auth

Examples of com.nimbusds.oauth2.sdk.auth.Secret


    claims.setEmail(new InternetAddress("alice@wonderland.net"));
    claims.setEmailVerified(true);

    JWTClaimsSet claimsSet = claims.toJWTClaimsSet();

    Secret secret = new Secret();

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);

    jwt.sign(new MACSigner(secret.getValueBytes()));

    UserInfoSuccessResponse response = new UserInfoSuccessResponse(jwt);

    assertEquals(jwt, response.getUserInfoJWT());
    assertEquals("application/jwt; charset=UTF-8", response.getContentType().toString());
View Full Code Here


    String passwordString = params.get("password");

    if (passwordString == null || passwordString.trim().isEmpty())
      throw new ParseException("Missing or empty \"password\" parameter", OAuth2Error.INVALID_REQUEST);

    Secret password = new Secret(passwordString);

    return new ResourceOwnerPasswordCredentialsGrant(username, password);
  }
View Full Code Here

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

    ClientMetadata metadata = ClientMetadata.parse(jsonObject);
   
    Secret clientSecret = null;
   
    if (jsonObject.get("client_secret") != null)
      clientSecret = new Secret(JSONObjectUtils.getString(jsonObject, "client_secret"));
     
    URI endpointURI;

    try {
      endpointURI = httpRequest.getURL().toURI();
View Full Code Here

    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

    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

    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");
    BearerAccessToken accessToken = new BearerAccessToken("xyz");

    OIDCClientInformation info = new OIDCClientInformation(clientID, now, metadata, secret, regURI, accessToken);

View Full Code Here

    assertNull(info.getSecret());
    assertNull(info.getRegistrationURI());
    assertNull(info.getRegistrationAccessToken());

    Date now = new Date(new Date().getTime() / 1000 * 1000);
    Secret secret = new Secret("secret");

    info = new ClientInformation(clientID, now, metadata, secret);

    assertEquals(clientID, info.getID());
    assertEquals(now, info.getIDIssueDate());
View Full Code Here

    assertNull(info.getSecret());
    assertNull(info.getRegistrationURI());
    assertNull(info.getRegistrationAccessToken());

    Date now = new Date(new Date().getTime() / 1000 * 1000);
    Secret secret = new Secret("secret");
    URI regURI = new URI("https://c2id.com/client-reg/123");
    BearerAccessToken accessToken = new BearerAccessToken("xyz");

    info = new ClientInformation(clientID, now, metadata, secret, regURI, accessToken);

View Full Code Here

    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);

    assertEquals(clientID, clientInfo.getID());
    assertNull(clientInfo.getIDIssueDate());
View Full Code Here


  public void testConstructor() {

    String username = "alice";
    Secret password = new Secret("secret");
    ResourceOwnerPasswordCredentialsGrant grant = new ResourceOwnerPasswordCredentialsGrant(username, password);
    assertEquals(GrantType.PASSWORD, grant.getType());
    assertEquals(username, grant.getUsername());
    assertEquals(password, grant.getPassword());
View Full Code Here

TOP

Related Classes of com.nimbusds.oauth2.sdk.auth.Secret

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.