Package com.nimbusds.jwt

Examples of com.nimbusds.jwt.SignedJWT.sign()


    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


    claimsSet.setExpirationTime(new Date(20000l));
    claimsSet.setClaim("nonce", "123");

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

    idToken.sign(new MACSigner("1234567890abcdef"));

    AuthenticationSuccessResponse response = new AuthenticationSuccessResponse(
      REDIRECT_URI, null, idToken, null, new State("abc"));

    assertEquals(REDIRECT_URI, response.getRedirectionURI());
View Full Code Here

    claimsSet.setExpirationTime(new Date(20000l));
    claimsSet.setClaim("nonce", "123");

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

    idToken.sign(new MACSigner("1234567890abcdef"));

    AuthenticationSuccessResponse response = new AuthenticationSuccessResponse(
      REDIRECT_URI, code, idToken, null, new State("abc"));

    assertEquals(REDIRECT_URI, response.getRedirectionURI());
View Full Code Here

    JWTClaimsSet claimsSet = new JWTClaimsSet();
    claimsSet.setIssuer("https://c2id.com");

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);
    jwt.sign(new MACSigner("abcdef1234567890"));

    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

  public void testRejectSoftwareStatementWithoutIssuer()
    throws Exception {

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), new JWTClaimsSet());
    jwt.sign(new MACSigner("abcdef1234567890"));

    OIDCClientMetadata metadata = new OIDCClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

    JWTClaimsSet claimsSet = new JWTClaimsSet();
    claimsSet.setIssuer("https://c2id.com");

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), claimsSet);
    jwt.sign(new MACSigner("abcdef1234567890"));

    ClientMetadata metadata = new ClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

  public void testRejectSoftwareStatementWithoutIssuer()
    throws Exception {

    SignedJWT jwt = new SignedJWT(new JWSHeader(JWSAlgorithm.HS256), new JWTClaimsSet());
    jwt.sign(new MACSigner("abcdef1234567890"));

    ClientMetadata metadata = new ClientMetadata();
    metadata.setRedirectionURI(new URI("https://client.com/in"));
    metadata.setName("Test App");
View Full Code Here

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

    JWSSigner signer = new MACSigner(key128);

    signedJWT.sign(signer);

    assertEquals(JWSObject.State.SIGNED, signedJWT.getState());

    Payload payload = new Payload(signedJWT);
    assertEquals(Payload.Origin.SIGNED_JWT, payload.getOrigin());
View Full Code Here

    claim.setIssueTime(DateTime.now().toDate());
    claim.setExpirationTime(DateTime.now().plusDays(14).toDate());
   
    JWSSigner signer = new MACSigner(TOKEN_SECRET);
    SignedJWT jwt = new SignedJWT(JWT_HEADER, claim);
    jwt.sign(signer);
   
    return new Token(jwt.serialize());
  }
 
  public static String getSerializedToken(String authHeader) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.