View Javadoc

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