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 com.nimbusds.jose.jwk.JWKSet;
022import net.jcip.annotations.Immutable;
023
024import java.util.Date;
025import java.util.Objects;
026
027
028/**
029 * JSON Web Key (JWK) set with timestamp.
030 *
031 * @author Vladimir Dzhuvinov
032 * @version 2024-04-20
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                this.jwkSet = Objects.requireNonNull(jwkSet);
062                this.timestamp = Objects.requireNonNull(timestamp);
063        }
064        
065        
066        /**
067         * Returns the JWK set.
068         *
069         * @return The JWK set.
070         */
071        public JWKSet getJWKSet() {
072                return jwkSet;
073        }
074        
075        
076        /**
077         * Returns the timestamp date.
078         *
079         * @return The timestamp date.
080         */
081        public Date getDate() {
082                return timestamp;
083        }
084}