Demo entry 2841791

ABC

   

Submitted by anonymous on Oct 09, 2015 at 09:13
Language: Java. Code size: 674 Bytes.

Calendar cal = Calendar.getInstance();
            JWTClaimsSet.Builder builder = new JWTClaimsSet.Builder().issuer(distributorId).issueTime(cal.getTime()).subject(key)
                    .jwtID(reqId)
                    .claim("a",accountId)
                    .claim("d",deviceId)
                    .claim("r",resourceId
                    ).claim("e",expired);
            cal.add(Calendar.SECOND, 120);
            builder.expirationTime(cal.getTime());
            SignedJWT signedJWT = new SignedJWT(new JWSHeader(JWSAlgorithm.RS256), builder.build());
            JWSSigner signer = new RSASSASigner(privateJWK);
            signedJWT.sign(signer);

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).