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.jwk.source; 019 020 021import java.util.Date; 022 023import net.jcip.annotations.Immutable; 024 025import com.nimbusds.jose.jwk.JWKSet; 026 027 028/** 029 * JSON Web Key (JWK) set with timestamp. 030 * 031 * @author Vladimir Dzhuvinov 032 * @version 2020-12-27 033 * @deprecated see {@linkplain RemoteJWKSet}. 034 */ 035@Deprecated 036@Immutable 037public final class JWKSetWithTimestamp { 038 039 040 private final JWKSet jwkSet; 041 042 043 private final Date timestamp; 044 045 046 /** 047 * Creates a new JWK set with a timestamp set to now. 048 */ 049 public JWKSetWithTimestamp(final JWKSet jwkSet) { 050 this(jwkSet, new Date()); 051 } 052 053 054 /** 055 * Creates a new JWK set with timestamp. 056 * 057 * @param jwkSet The JWK set. Must not be {@code null}. 058 * @param timestamp The timestamp date. Must not be {@code null}. 059 */ 060 public JWKSetWithTimestamp(final JWKSet jwkSet, final Date timestamp) { 061 if (jwkSet == null) { 062 throw new IllegalArgumentException("The JWK set must not be null"); 063 } 064 this.jwkSet = jwkSet; 065 if (timestamp == null) { 066 throw new IllegalArgumentException("The timestamp must not null"); 067 } 068 this.timestamp = timestamp; 069 } 070 071 072 /** 073 * Returns the JWK set. 074 * 075 * @return The JWK set. 076 */ 077 public JWKSet getJWKSet() { 078 return jwkSet; 079 } 080 081 082 /** 083 * Returns the timestamp date. 084 * 085 * @return The timestamp date. 086 */ 087 public Date getDate() { 088 return timestamp; 089 } 090}