01: /*
02: * CoadunationClient: The client libraries for Coadunation. (RMI/CORBA)
03: * Copyright (C) 2006 Rift IT Contracting
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18: *
19: * Session.java
20: *
21: * This credential object represents and active session for a user.
22: */
23:
24: // package path
25: package com.rift.coad.lib.interceptor.credentials;
26:
27: // java imports
28: import java.util.Set;
29:
30: /**
31: * This credential object represents and active session for a user.
32: *
33: * @author Brett Chaldecott
34: */
35: public class Session extends Credential {
36:
37: // private member variables
38: private String sessionId = null;
39: private Set principals = null;
40:
41: /**
42: * Creates a new instance of Session
43: */
44: public Session() {
45: }
46:
47: /**
48: * This constructor is responsible for setting the session id and principals
49: * information.
50: *
51: * @param username The name of the user.
52: * @param sessionId The id for this session.
53: * @param principals The list of principals.
54: */
55: public Session(String username, String sessionId, Set principals) {
56: super (username);
57: this .sessionId = sessionId;
58: this .principals = principals;
59: }
60:
61: /**
62: * This method returns the id of this session.
63: *
64: * @return The id of this session.
65: */
66: public String getSessionId() {
67: return sessionId;
68: }
69:
70: /**
71: * This method sets the session id.
72: *
73: * @param sessionId The id of the session to set.
74: */
75: public void setSessionId(String sessionId) {
76: this .sessionId = sessionId;
77: }
78:
79: /**
80: * This method returns a list of principals.
81: *
82: * @return The list of principals.
83: */
84: public Set getPrincipals() {
85: return principals;
86: }
87:
88: /**
89: * This method sets the principals for a session
90: *
91: * @param principals The set of principals to apply
92: */
93: public void setPrincipals(Set principals) {
94: this.principals = principals;
95: }
96: }
|