com.ecyrd.jspwiki.auth
Class WikiSecurityEvent

java.lang.Object
  extended by java.util.EventObject
      extended by com.ecyrd.jspwiki.event.WikiEvent
          extended by com.ecyrd.jspwiki.auth.WikiSecurityEvent
All Implemented Interfaces:
Serializable

public final class WikiSecurityEvent
extends WikiEvent

Event class for security events: login/logout, wiki group adds/changes, and authorization decisions. When a WikiSecurityEvent is constructed, the security logger LOGGER is notified.

These events are logged with priority ERROR:

These events are logged with priority WARN:

These events are logged with priority INFO:

These events are logged with priority DEBUG:

Since:
2.3.79
Version:
$Revision: 1.7 $ $Date: 2006/06/17 23:10:45 $
Author:
Andrew Jaquith
See Also:
Serialized Form

Field Summary
static int ACCESS_ALLOWED
          When access to a resource is allowed.
static int ACCESS_DENIED
          When access to a resource is allowed.
static int GROUP_ADD
          When a new wiki group is added.
static int GROUP_ADD_MEMBER
          When a new member is added to a wiki group.
static int GROUP_CLEAR_GROUPS
          When all wiki groups are removed from GroupManager.
static int GROUP_CLEAR_MEMBERS
          When all members are cleared from a wiki group.
static int GROUP_REMOVE
          When a wiki group is deleted.
static int GROUP_REMOVE_MEMBER
          When a member is removed from a wiki group.
static org.apache.log4j.Logger LOGGER
          The security logging service.
static int LOGIN_ACCOUNT_EXPIRED
          When a login fails due to account expiration.
static int LOGIN_AUTHENTICATED
          When a user authenticates with a username and password, or via container auth.
static int LOGIN_CREDENTIAL_EXPIRED
          When a login fails due to credential expiration.
static int LOGIN_FAILED
          When a login fails due to wrong username or password.
static int LOGOUT
          When a user logs out.
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
WikiSecurityEvent(Object source, int type, Object target)
          Constructs a new instance of this event type, which signals a security event has occurred.
WikiSecurityEvent(Object source, int type, Principal principal, Object target)
          Constructs a new instance of this event type, which signals a security event has occurred.
 
Method Summary
protected static String eventName(int type)
          Returns a textual representation of an event type.
 Object getPrincipal()
          Returns the principal to whom the opeation applied, if supplied.
 Object getTarget()
          Returns the object that was operated on, if supplied.
 String toString()
          Prints a String (human-readable) representation of this object.
 
Methods inherited from class com.ecyrd.jspwiki.event.WikiEvent
getType
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOGIN_AUTHENTICATED

public static final int LOGIN_AUTHENTICATED
When a user authenticates with a username and password, or via container auth.

See Also:
Constant Field Values

LOGIN_ACCOUNT_EXPIRED

public static final int LOGIN_ACCOUNT_EXPIRED
When a login fails due to account expiration.

See Also:
Constant Field Values

LOGIN_CREDENTIAL_EXPIRED

public static final int LOGIN_CREDENTIAL_EXPIRED
When a login fails due to credential expiration.

See Also:
Constant Field Values

LOGIN_FAILED

public static final int LOGIN_FAILED
When a login fails due to wrong username or password.

See Also:
Constant Field Values

LOGOUT

public static final int LOGOUT
When a user logs out.

See Also:
Constant Field Values

GROUP_ADD

public static final int GROUP_ADD
When a new wiki group is added.

See Also:
Constant Field Values

GROUP_REMOVE

public static final int GROUP_REMOVE
When a wiki group is deleted.

See Also:
Constant Field Values

GROUP_CLEAR_GROUPS

public static final int GROUP_CLEAR_GROUPS
When all wiki groups are removed from GroupManager.

See Also:
Constant Field Values

GROUP_ADD_MEMBER

public static final int GROUP_ADD_MEMBER
When a new member is added to a wiki group.

See Also:
Constant Field Values

GROUP_REMOVE_MEMBER

public static final int GROUP_REMOVE_MEMBER
When a member is removed from a wiki group.

See Also:
Constant Field Values

GROUP_CLEAR_MEMBERS

public static final int GROUP_CLEAR_MEMBERS
When all members are cleared from a wiki group.

See Also:
Constant Field Values

ACCESS_ALLOWED

public static final int ACCESS_ALLOWED
When access to a resource is allowed.

See Also:
Constant Field Values

ACCESS_DENIED

public static final int ACCESS_DENIED
When access to a resource is allowed.

See Also:
Constant Field Values

LOGGER

public static final org.apache.log4j.Logger LOGGER
The security logging service.

Constructor Detail

WikiSecurityEvent

public WikiSecurityEvent(Object source,
                         int type,
                         Principal principal,
                         Object target)
Constructs a new instance of this event type, which signals a security event has occurred. The source parameter is required, and may not be null. When the WikiSecurityEvent is constructed, the security logger LOGGER is notified.

Parameters:
source - the source of the event, which can be any object: a wiki page, group or authentication/authentication/group manager.
type - the type of event
principal - the subject of the event, which may be null
target - the changed Object, which may be null

WikiSecurityEvent

public WikiSecurityEvent(Object source,
                         int type,
                         Object target)
Constructs a new instance of this event type, which signals a security event has occurred. The source parameter is required, and may not be null. When the WikiSecurityEvent is constructed, the security logger LOGGER is notified.

Parameters:
source - the source of the event, which can be any object: a wiki page, group or authentication/authentication/group manager.
type - the type of event
target - the changed Object, which may be null.
Method Detail

getPrincipal

public final Object getPrincipal()
Returns the principal to whom the opeation applied, if supplied. This method may return null — and calling methods should check for this condition.

Returns:
the changed object

getTarget

public final Object getTarget()
Returns the object that was operated on, if supplied. This method may return null — and calling methods should check for this condition.

Returns:
the changed object

toString

public final String toString()
Prints a String (human-readable) representation of this object.

Overrides:
toString in class EventObject
See Also:
Object.toString()

eventName

protected static final String eventName(int type)
Returns a textual representation of an event type.

Parameters:
type - the type
Returns:
the string representation