001/*
002 * nimbus-jose-jwt
003 *
004 * Copyright 2012-2016, 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.jwk.JWK;
022
023import java.util.List;
024import java.util.Objects;
025
026/**
027 * A security context that contains JSON Web Keys (JWK). Typically, this would
028 * be used when the keys are evaluated outside the token validation.
029 *
030 * @author Rob Winch
031 * @author Josh Cummings
032 * @version 2024-04-20
033 */
034public class JWKSecurityContext implements SecurityContext {
035
036
037        private final List<JWK> keys;
038
039        /**
040         * Constructs a {@code JWKSecurityContext} with the provided
041         * parameters.
042         *
043         * @param keys The list of keys.
044         */
045        public JWKSecurityContext(final List<JWK> keys) {
046                this.keys = Objects.requireNonNull(keys);
047        }
048
049        /**
050         * Gets the list of {@link JWK}s.
051         *
052         * @return The {@code JWK} list.
053         */
054        public List<JWK> getKeys() {
055                return keys;
056        }
057}