001package com.nimbusds.openid.connect.sdk.util; 002 003 004import java.text.ParseException; 005 006import com.nimbusds.jose.JOSEException; 007import com.nimbusds.jwt.JWT; 008import com.nimbusds.jwt.ReadOnlyJWTClaimsSet; 009 010 011/** 012 * Decoder of JSON Web Tokens (JWTs). Handles plain JWTs as well as JWTs 013 * secured by means of JSON Web Signature (JWS) and / or JSON Web Encryption 014 * (JWE). If the object is secured performs the necessary JWS validation and / 015 * or JWE decryption. 016 * 017 * @author Vladimir Dzhuvinov 018 */ 019public interface JWTDecoder { 020 021 022 /** 023 * Decodes a JWT object, then applies JWS signature validation and / or 024 * JWE decryption if the token is secured. 025 * 026 * @param jwt The JWT to decode. Must not be {@code null}. 027 * 028 * @return The JWT claims set. 029 * 030 * @throws JOSEException If decoding, JWS validation and / or JWE 031 * decryption of the JWT failed. 032 * @throws ParseException If parsing of the JWT claims set failed. 033 */ 034 public ReadOnlyJWTClaimsSet decodeJWT(final JWT jwt) 035 throws JOSEException, ParseException; 036}