Package com.nimbusds.oauth2.sdk.id

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


  public void testStringClaim() {

    IDTokenClaimsSet claimsSet = new IDTokenClaimsSet(
      new Issuer("iss"),
      new Subject("sub"),
      new Audience("aud").toSingleAudienceList(),
      new Date(),
      new Date());

    claimsSet.setClaim("xString", "apples");
View Full Code Here


  public void testNumberClaim() {

    IDTokenClaimsSet claimsSet = new IDTokenClaimsSet(
      new Issuer("iss"),
      new Subject("sub"),
      new Audience("aud").toSingleAudienceList(),
      new Date(),
      new Date());

    claimsSet.setClaim("xInteger", 10);
View Full Code Here

  public void testURLClaim()
    throws Exception {

    IDTokenClaimsSet claimsSet = new IDTokenClaimsSet(
      new Issuer("iss"),
      new Subject("sub"),
      new Audience("aud").toSingleAudienceList(),
      new Date(),
      new Date());

    claimsSet.setURLClaim("xURL", new URL("http://example.com"));
View Full Code Here

   *
   * @return The subject.
   */
  public Subject getSubject() {

    return new Subject(getStringClaim(SUB_CLAIM_NAME));
  }
View Full Code Here

    sha256.update(sectorIdentifier.getBytes(charset));
    sha256.update(localSub.getValue().getBytes(charset));
    byte[] hash = sha256.digest(salt);

    return new Subject(Base64.encodeBase64URLSafeString(hash));
  }
View Full Code Here

   * @throws IllegalArgumentException If the other UserInfo claims set
   *                                  doesn't have an identical subject.
   */
  public void putAll(final UserInfo other) {

    Subject otherSubject = other.getSubject();

    if (otherSubject == null)
      throw new IllegalArgumentException("The subject of the other UserInfo is missing");

    if (! otherSubject.equals(getSubject()))
      throw new IllegalArgumentException("The subject of the other UserInfo must be identical");

    putAll((ClaimsSet)other);
  }
View Full Code Here

   *
   * @return The subject.
   */
  public Subject getSubject() {
 
    return new Subject(getStringClaim(SUB_CLAIM_NAME));
  }
View Full Code Here

    assertTrue(new ResponseType("token").equals(responseType));

    Map<String,String> params = resp.toParameters();
    assertEquals(TOKEN.getValue(), params.get("access_token"));
    assertEquals(STATE, new State(params.get("state")));
    assertEquals(TOKEN.getType(), new AccessTokenType(params.get("token_type")));
    assertEquals("3600", params.get("expires_in"));
    assertEquals(4, params.size());

    URI uri = resp.toURI();
View Full Code Here

    AuthorizationSuccessResponse response = AuthorizationSuccessResponse.parse(redirectionURI);
    assertEquals("https://client.example.org/cb", response.getRedirectionURI().toString());
    assertNull(response.getAuthorizationCode());
    assertEquals("xyz", response.getState().getValue());
    BearerAccessToken accessToken = (BearerAccessToken)response.getAccessToken();
    assertEquals("2YotnFZFEjr1zCsicMWpAA", accessToken.getValue());
    assertEquals(3600l, accessToken.getLifetime());
  }
View Full Code Here

    String refreshTokenString = params.get("refresh_token");

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

    RefreshToken refreshToken = new RefreshToken(refreshTokenString);

    return new RefreshTokenGrant(refreshToken);
  }
View Full Code Here

TOP

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

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.