Validate Signatures
[java-idp.git] / src / edu / internet2 / middleware / shibboleth / serviceprovider / Session.java
1 /*
2  * Session.java
3  * 
4  * Session object holds Principal ID [handle] and Attributes.
5  * A random ID is used as the object key in the Cache and
6  * is returned to the Browser as a Cookie value. 
7  *
8  * Recovery Context: No exceptions expected or generated.
9  * 
10  * --------------------
11  * Copyright 2002, 2004 
12  * University Corporation for Advanced Internet Development, Inc. 
13  * All rights reserved
14  * [Thats all we have to say to protect ourselves]
15  * Your permission to use this code is governed by "The Shibboleth License".
16  * A copy may be found at http://shibboleth.internet2.edu/license.html
17  * [Nothing in copyright law requires license text in every file.]
18  */
19 package edu.internet2.middleware.shibboleth.serviceprovider;
20
21 import java.io.Serializable;
22 import org.opensaml.SAMLAssertion;
23 import org.opensaml.SAMLAuthenticationStatement;
24 import org.opensaml.SAMLResponse;
25
26 /**
27  * Session object holds Authentication and Attribute Assertions for one
28  * remote Browser/User.<br>
29  * Each session generates its own UUID key.<br>
30  * The collection of Session objects may be checkpointed to disk using
31  * any attractive persistence framework, Object Relational mapping, 
32  * or, hell, just serialize the objects to a flat file if you like.
33  *
34  *  @author Howard Gilbert
35  */
36 public class Session implements Serializable {
37         
38         Session(String key) {
39                 // Should only be created by SessionManager
40             this.key=key;
41         }
42         
43         // Properties
44         
45         private String key;
46         public String getKey() {
47                 return key;
48         }
49         
50         private String applicationId = null;
51         public String getApplicationId() {
52                 return applicationId;
53         }
54         public void setApplicationId(String applicationId) {
55                 this.applicationId = applicationId;
56         }
57         
58         private String ipaddr = null;
59         public String getIpaddr() {
60                 return ipaddr;
61         }
62         public void setIpaddr(String ipaddr) {
63                 this.ipaddr = ipaddr;
64         }
65         
66         private String entityId = null; // a.k.a providerId
67         
68         public String getEntityId() {
69                 return entityId;
70         }
71         public void setEntityId(String entityId) {
72                 this.entityId = entityId;
73         }
74         private long lifetime;
75         public long getLifetime() {
76                 return lifetime;
77         }
78         public void setLifetime(long lifetime) {
79                 this.lifetime = lifetime;
80         }
81         
82         private long timeout;
83         public long getTimeout() {
84                 return timeout;
85         }
86         public void setTimeout(long timeout) {
87                 this.timeout = timeout;
88         }
89         
90     // private persisted variable
91         private long timestamp = System.currentTimeMillis();
92         
93         
94         // Stuff saved from the POST
95         private SAMLAssertion authenticationAssertion = null;
96         public SAMLAssertion getAuthenticationAssertion() {
97                 return authenticationAssertion;
98         }
99         public void setAuthenticationAssertion(SAMLAssertion authentication) {
100                 this.authenticationAssertion = authentication;
101         }
102         
103         private SAMLAuthenticationStatement authenticationStatement=null;
104         public SAMLAuthenticationStatement getAuthenticationStatement() {
105                 return authenticationStatement;
106         }
107         public void setAuthenticationStatement(
108                         SAMLAuthenticationStatement authenticationStatement) {
109                 this.authenticationStatement = authenticationStatement;
110         }
111         
112         // Stuff saved from the Attribute Query
113         private SAMLResponse attributeResponse = null;
114         public SAMLResponse getAttributeResponse() {
115                 return attributeResponse;
116         }
117         public void setAttributeResponse(SAMLResponse attributeResponse) {
118                 this.attributeResponse = attributeResponse;
119         }
120
121         
122         public void renew(){
123                 timestamp = System.currentTimeMillis();
124         }
125         
126
127 }