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.proc;
019
020
021/**
022 * JOSE processor configuration.
023 *
024 * <p>Specifies the required components to process secured JOSE objects:
025 *
026 * <ul>
027 *     <li>To verify JWS objects:
028 *         <ul>
029 *             <li>Key selector to determine key candidate(s) for JWS
030 *                 verification based on the JWS header and application-
031 *                 specific context information.
032 *             <li>Factory to construct a JWS verifier for a given key
033 *                 candidate and JWS header information.
034 *         </ul>
035 *     <li>To decrypt JWT objects:
036 *         <ul>
037 *             <li>Key selector to determine key candidate(s) for JWE
038 *                 decryption based on the JWS header and application-specific
039 *                 context information.
040 *             <li>Factory to construct a JWE decrypter for a given key
041 *                 candidate and JWE header information.
042 *         </ul>
043 * </ul>
044 *
045 * @author Vladimir Dzhuvinov
046 * @version 2015-08-22
047 */
048public interface JOSEProcessorConfiguration <C extends SecurityContext> {
049
050
051        /**
052         * Gets the JWS key selector.
053         *
054         * @return The JWS key selector, {@code null} if not specified.
055         */
056        JWSKeySelector<C> getJWSKeySelector();
057
058
059        /**
060         * Sets the JWS key selector.
061         *
062         * @param jwsKeySelector The JWS key selector, {@code null} if not
063         *                       specified.
064         */
065        void setJWSKeySelector(final JWSKeySelector<C> jwsKeySelector);
066
067
068        /**
069         * Gets the JWE key selector.
070         *
071         * @return The JWE key selector, {@code null} if not specified.
072         */
073        JWEKeySelector<C> getJWEKeySelector();
074
075
076        /**
077         * Sets the JWE key selector.
078         *
079         * @param jweKeySelector The JWE key selector, {@code null} if not
080         *                       specified.
081         */
082        void setJWEKeySelector(final JWEKeySelector<C> jweKeySelector);
083
084
085        /**
086         * Gets the factory for creating JWS verifier instances.
087         *
088         * @return The JWS verifier factory, {@code null} if not specified.
089         */
090        JWSVerifierFactory getJWSVerifierFactory();
091
092
093        /**
094         * Sets the factory for creating JWS verifier instances.
095         *
096         * @param factory The JWS verifier factory, {@code null} if not
097         *                specified.
098         */
099        void setJWSVerifierFactory(final JWSVerifierFactory factory);
100
101
102        /**
103         * Gets the factory for creating JWE decrypter instances.
104         *
105         * @return The JWE decrypter factory, {@code null} if not specified.
106         */
107        JWEDecrypterFactory getJWEDecrypterFactory();
108
109
110        /**
111         * Sets the factory for creating JWE decrypter instances.
112         *
113         * @param factory The JWE decrypter factory, {@code null} if not
114         *                specified.
115         */
116        void setJWEDecrypterFactory(final JWEDecrypterFactory factory);
117}