001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2019, Connect2id Ltd and contributors. 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.jose.proc; 019 020 021import com.nimbusds.jose.JOSEObjectType; 022 023 024/** 025 * JOSE object type (header "typ" parameter) verifier. 026 * 027 * <p>Example JOSE header with a "typ" (type) parameter set to "at+jwt": 028 * 029 * <pre> 030 * { 031 * "alg" : "ES256", 032 * "typ" : "at+jwt", 033 * "kid" : "123" 034 * } 035 * </pre> 036 * 037 * @author Vladimir Dzhuvinov 038 * @version 2019-10-14 039 * @since 8.0 040 */ 041public interface JOSEObjectTypeVerifier <C extends SecurityContext> { 042 043 044 /** 045 * Verifies the JOSE "typ" (type) header parameter. 046 * 047 * @param type The "typ" (type) header parameter, {@code null} if 048 * not set. 049 * @param context Optional context, {@code null} if not required. 050 * 051 * @throws BadJOSEException If the type is rejected. 052 */ 053 void verify(final JOSEObjectType type, final C context) 054 throws BadJOSEException; 055}