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.session;
19  
20  import java.io.Serializable;
21  
22  import javax.security.auth.Subject;
23  
24  import org.joda.time.DateTime;
25  
26  /** Session information for user currently logged in. */
27  public interface Session extends Serializable {
28  
29      /**
30       * Gets the unique identifier of the session.
31       * 
32       * @return unique identifier of the session
33       */
34      public String getSessionID();
35  
36      /**
37       * Gets the subject with which this session is associated.
38       * 
39       * @return subject with which this session is associated
40       */
41      public Subject getSubject();
42      
43      /**
44       * Sets the subject with which this session is associated.
45       * 
46       * @param newSubject the subject with which this session is associated
47       */
48      public void setSubject(Subject newSubject);
49  
50      /**
51       * A convenience method that gets the first principal retrieved from the {@link Subject}.
52       * 
53       * @return principal ID of the user, or null
54       */
55      public String getPrincipalName();
56  
57      /**
58       * Gets the session inactivity timeout in milliseconds.
59       * 
60       * @return session inactivity timeout in milliseconds
61       */
62      public long getInactivityTimeout();
63  
64      /**
65       * Gets the time of the last activity from the user.
66       * 
67       * @return time of the last activity from the user
68       */
69      public DateTime getLastActivityInstant();
70  
71      /**
72       * Sets the time of the last activity from the user.
73       * 
74       * @param lastActivity time of the last activity from the user
75       */
76      public void setLastActivityInstant(DateTime lastActivity);
77  }