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.jose;
019
020
021import java.util.Set;
022
023
024/**
025 * JSON Web Signature (JWS) verifier or JSON Web Encryption (JWE) decrypter
026 * that supports processing and / or deferral of critical ({@code crit}) header
027 * parameters.
028 *
029 * <p>JWS verification / JWE decryption will fail with a {@link JOSEException}
030 * if a critical header is encountered that is neither processed by the
031 * verifier / decrypter nor deferred to the application.
032 *
033 * @author Vladimir Dzhuvinov
034 * @version 2015-04-21
035 */
036public interface CriticalHeaderParamsAware {
037
038
039        /**
040         * Returns the names of the critical ({@code crit}) header parameters
041         * that are understood and processed by the JWS verifier / JWE
042         * decrypter.
043         *
044         * @return The names of the critical header parameters that are
045         *         understood and processed, empty set if none.
046         */
047        Set<String> getProcessedCriticalHeaderParams();
048
049
050        /**
051         * Returns the names of the critical ({@code crit}) header parameters
052         * that are deferred to the application for processing and will be
053         * ignored by the JWS verifier / JWE decrypter.
054         *
055         * @return The names of the critical header parameters that are
056         *         deferred to the application for processing, empty set if
057         *         none.
058         */
059        Set<String> getDeferredCriticalHeaderParams();
060}