001package com.nimbusds.jwt.proc;
002
003
004import com.nimbusds.jose.proc.SecurityContext;
005import com.nimbusds.jwt.JWTClaimsSet;
006
007
008/**
009 * JWT claims set verifier. Ensures the claims set of a JWT that is being
010 * {@link JWTProcessor processed} complies with an application's requirements.
011 *
012 * <p>An application may implement JWT claims checks such as:
013 *
014 * <ul>
015 *     <li>The JWT is within the required validity time window;
016 *     <li>has a specific issuer;
017 *     <li>has a specific audience;
018 *     <li>has a specific subject;
019 *     <li>etc.
020 * </ul>
021 *
022 * @author Vladimir Dzhuvinov
023 * @version 2016-07-25
024 * @since 4.23
025 */
026public interface JWTClaimsSetVerifier <C extends SecurityContext> {
027        
028        
029        /**
030         * Verifies selected or all claims from the specified JWT claims set.
031         *
032         * @param claimsSet The JWT claims set. Not {@code null}.
033         * @param context   Optional context, {@code null} if not required.
034         *
035         * @throws BadJWTException If the JWT claims set is rejected.
036         */
037        void verify(final JWTClaimsSet claimsSet, final C context)
038                throws BadJWTException;
039}