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.gateway.event.security;
22:
23: import org.josso.gateway.event.BaseSSOEvent;
24:
25: /**
26: * Event for notifying chages releated to an SSO Session.
27: *
28: * @author <a href="mailto:sgonzalez@josso.org">Sebastian Gonzalez Oyuela</a>
29: * @version $Id: SSOSessionEvent.java 508 2008-02-18 13:32:29Z sgonzalez $
30: */
31:
32: public class SSOSessionEvent extends BaseSSOEvent {
33:
34: /**
35: * The data associated with this event.
36: */
37: private Object data = null;
38:
39: private String username;
40:
41: /**
42: * Construct a new SessionEvent
43: *
44: * @param sessionId SSO Session identifier on which this event occurred
45: * @param type
46: * @param data
47: */
48: public SSOSessionEvent(String username, String sessionId,
49: String type, Object data) {
50: super (type, sessionId);
51: this .data = data;
52: this .username = username;
53: }
54:
55: public SSOSessionEvent(String username, String sessionId,
56: String type, Throwable error) {
57: super (type, sessionId, error);
58: this .username = username;
59: }
60:
61: /**
62: * Return the event this._data of this event.
63: */
64: public Object getData() {
65: return (this .data);
66: }
67:
68: /**
69: * Return the Session on which this event occurred.
70: */
71: public String getSessionId() {
72: return (String) getSource();
73: }
74:
75: /**
76: * Returns the username associated to this event.
77: */
78: public String getUsername() {
79: return username;
80: }
81:
82: /**
83: * Return a string representation of this event.
84: */
85: public String toString() {
86: return ("SSOSessionEvent['" + getSessionId() + "','"
87: + getType() + "']");
88: }
89:
90: }
|