/** * Creates a new to-be-signed JSON Web Signature (JWS) object with the * specified header and payload. The initial state will be * {@link State#UNSIGNED unsigned}. * * @param header The JWS header. Must not be {@code null}. * @param payload The payload. Must not be {@code null}. */ public JWSObject(final JWSHeader header, final Payload payload) { if (header == null) { throw new IllegalArgumentException("The JWS header must not be null"); } this.header = header; if (payload == null) { throw new IllegalArgumentException("The payload must not be null"); } setPayload(payload); signingInputString = composeSigningInput(header.toBase64URL(), payload.toBase64URL()); signature = null; state = State.UNSIGNED; }
/** * Serialises this unsecured JOSE object to its compact format * consisting of Base64URL-encoded parts delimited by period ('.') * characters. * * <pre> * [header-base64url].[payload-base64url].[] * </pre> * * @return The serialised unsecured JOSE object. */ @Override public String serialize() { return header.toBase64URL().toString() + '.' + getPayload().toBase64URL().toString() + '.'; }
return SignedJWT.parse(jwt.getPayload().toBase64URL().decodeToString());