/** * Parses a JWE header from the specified Base64URL. * * @param base64URL The Base64URL to parse. Must not be {@code null}. * * @return The JWE header. * * @throws ParseException If the specified Base64URL doesn't represent * a valid JWE header. */ public static JWEHeader parse(final Base64URL base64URL) throws ParseException { return parse(base64URL.decodeToString(), base64URL); } }
/** * Parses a JWS header from the specified Base64URL. * * @param base64URL The Base64URL to parse. Must not be {@code null}. * * @return The JWS header. * * @throws ParseException If the specified Base64URL doesn't represent * a valid JWS header. */ public static JWSHeader parse(final Base64URL base64URL) throws ParseException { return parse(base64URL.decodeToString(), base64URL); } }
/** * Parses an unsecured header from the specified Base64URL. * * @param base64URL The Base64URL to parse. Must not be {@code null}. * * @return The unsecured header. * * @throws ParseException If the specified Base64URL doesn't represent * a valid unsecured header. */ public static PlainHeader parse(final Base64URL base64URL) throws ParseException { return parse(base64URL.decodeToString(), base64URL); } }
/** * Parses a {@link PlainHeader}, {@link JWSHeader} or {@link JWEHeader} * from the specified Base64URL. * * @param base64URL The Base64URL to parse. Must not be {@code null}. * * @return The header. * * @throws ParseException If the specified Base64URL doesn't represent * a valid header. */ public static Header parse(final Base64URL base64URL) throws ParseException { return parse(base64URL.decodeToString(), base64URL); } }
jsonObject = JSONObjectUtils.parse(header.decodeToString());
jsonObject = JSONObjectUtils.parse(parts[0].decodeToString());
/** * Returns a string representation of this payload. * * @return The string representation. */ @Override public String toString() { if (string != null) { return string; } // Convert if (jwsObject != null) { if (jwsObject.getParsedString() != null) { return jwsObject.getParsedString(); } else { return jwsObject.serialize(); } } else if (jsonObject != null) { return jsonObject.toString(); } else if (bytes != null) { return byteArrayToString(bytes); } else if (base64URL != null) { return base64URL.decodeToString(); } else { return null; // should never happen } }
return SignedJWT.parse(jwt.getPayload().toBase64URL().decodeToString());