001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2016, Connect2id Ltd. 005 * 006 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use 007 * this file except in compliance with the License. You may obtain a copy of the 008 * License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software distributed 013 * under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 014 * CONDITIONS OF ANY KIND, either express or implied. See the License for the 015 * specific language governing permissions and limitations under the License. 016 */ 017 018package com.nimbusds.jwt.proc; 019 020 021import com.nimbusds.jose.proc.SecurityContext; 022import com.nimbusds.jwt.JWTClaimsSet; 023 024 025/** 026 * JWT claims set verifier. Ensures the claims set of a JWT that is being 027 * {@link JWTProcessor processed} complies with an application's requirements. 028 * 029 * <p>An application may implement JWT claims checks such as: 030 * 031 * <ul> 032 * <li>The JWT is within the required validity time window; 033 * <li>has a specific issuer; 034 * <li>has a specific audience; 035 * <li>has a specific subject; 036 * <li>etc. 037 * </ul> 038 * 039 * @author Vladimir Dzhuvinov 040 * @version 2016-07-25 041 * @since 4.23 042 */ 043public interface JWTClaimsSetVerifier <C extends SecurityContext> { 044 045 046 /** 047 * Verifies selected or all claims from the specified JWT claims set. 048 * 049 * @param claimsSet The JWT claims set. Not {@code null}. 050 * @param context Optional context, {@code null} if not required. 051 * 052 * @throws BadJWTException If the JWT claims set is rejected. 053 */ 054 void verify(final JWTClaimsSet claimsSet, final C context) 055 throws BadJWTException; 056}