001/* 002 * nimbus-jose-jwt 003 * 004 * Copyright 2012-2022, 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.jwk.source; 019 020 021import java.io.Closeable; 022 023import com.nimbusds.jose.KeySourceException; 024import com.nimbusds.jose.jwk.JWKSet; 025import com.nimbusds.jose.proc.SecurityContext; 026 027 028/** 029 * JSON Web Key (JWK) set source. 030 * 031 * @author Thomas Rørvik Skjølberg 032 * @author Vladimir Dzhuvinov 033 * @version 2022-11-22 034 */ 035public interface JWKSetSource<C extends SecurityContext> extends Closeable { 036 037 038 /** 039 * Gets the JWK set. 040 * 041 * @param refreshEvaluator Controls whether refresh of the JWK set 042 * cache (if utilised by the source) is 043 * required. 044 * @param currentTime The current time, in milliseconds since the 045 * Unix epoch. 046 * @param context Optional context, {@code null} if not 047 * required. 048 * 049 * @return The JWK set. 050 * 051 * @throws KeySourceException If JWK set retrieval failed. 052 */ 053 JWKSet getJWKSet(final JWKSetCacheRefreshEvaluator refreshEvaluator, final long currentTime, final C context) 054 throws KeySourceException; 055}