01: /*
02: * JOSSO: Java Open Single Sign-On
03: *
04: * Copyright 2004-2008, Atricore, Inc.
05: *
06: * This is free software; you can redistribute it and/or modify it
07: * under the terms of the GNU Lesser General Public License as
08: * published by the Free Software Foundation; either version 2.1 of
09: * the License, or (at your option) any later version.
10: *
11: * This software is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this software; if not, write to the Free
18: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
19: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
20: */
21: package org.josso.agent;
22:
23: import java.security.Principal;
24:
25: /**
26: * A class representing entries in the cache of authenticated users.
27: *
28: * @author <a href="mailto:gbrigand@josso.org">Gianluca Brigandi</a>
29: * @version CVS $Id: SingleSignOnEntry.java 508 2008-02-18 13:32:29Z sgonzalez $
30: */
31: public class SingleSignOnEntry {
32:
33: public String authType = null;
34: public String password = null;
35: public Principal principal = null;
36: public LocalSession sessions[] = new LocalSession[0];
37: public String ssoId = null;
38: public long lastAccessTime;
39:
40: public SingleSignOnEntry(String ssoId, Principal principal,
41: String authType) {
42: super ();
43: this .principal = principal;
44: this .ssoId = ssoId;
45: this .authType = authType;
46: }
47:
48: /**
49: * Associates a Local Session (i.e.: Servlet Container Session) with
50: * the authenticated Single Sign-On Session.
51: *
52: * @param localSession the local session to be associated with the single sign-on session.
53: */
54: public synchronized void addSession(LocalSession localSession) {
55: for (int i = 0; i < sessions.length; i++) {
56: if (localSession == sessions[i])
57: return;
58: }
59: LocalSession results[] = new LocalSession[sessions.length + 1];
60: System.arraycopy(sessions, 0, results, 0, sessions.length);
61: results[sessions.length] = localSession;
62: sessions = results;
63: }
64:
65: /**
66: * Provides the list of local sessions associated with the Single Sign-on Session.
67: *
68: */
69: public synchronized LocalSession[] findSessions() {
70: return (this.sessions);
71: }
72:
73: }
|