View Javadoc

1   /*
2    * Licensed to the University Corporation for Advanced Internet Development, 
3    * Inc. (UCAID) under one or more contributor license agreements.  See the 
4    * NOTICE file distributed with this work for additional information regarding
5    * copyright ownership. The UCAID licenses this file to You under the Apache 
6    * License, Version 2.0 (the "License"); you may not use this file except in 
7    * compliance with the License.  You may obtain a copy of the License at
8    *
9    *    http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  package edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attributeDefinition;
19  
20  import org.joda.time.DateTime;
21  import org.opensaml.util.storage.AbstractExpiringObject;
22  
23  /** Storage service entry used to store information associated with a transient ID. */
24  public class TransientIdEntry extends AbstractExpiringObject {
25  
26      /** Serial version UID. */
27      private static final long serialVersionUID = 3594553144206354129L;
28  
29      /** Relying party the token was issued to. */
30      private String relyingPartyId;
31  
32      /** Principal for which the token was issued. */
33      private String principalName;
34  
35      /** Transient id. */
36      private String id;
37  
38      /**
39       * Constructor.
40       * 
41       * @param lifetime lifetime of the token in milliseconds
42       * @param relyingParty relying party the token was issued to
43       * @param principal principal the token was issued for
44       * @param randomId the random ID token
45       */
46      public TransientIdEntry(long lifetime, String relyingParty, String principal, String randomId) {
47          super(new DateTime().plus(lifetime));
48          relyingPartyId = relyingParty;
49          principalName = principal;
50          id = randomId;
51      }
52  
53      /**
54       * Gets the principal the token was issued for.
55       * 
56       * @return principal the token was issued for
57       */
58      public String getPrincipalName() {
59          return principalName;
60      }
61  
62      /**
63       * Gets the relying party the token was issued to.
64       * 
65       * @return relying party the token was issued to
66       */
67      public String getRelyingPartyId() {
68          return relyingPartyId;
69      }
70  
71      /**
72       * Gets the ID.
73       * 
74       * @return ID
75       */
76      public String getId() {
77          return id;
78      }
79  }