Package org.apache.wiki.event

# Class WikiSecurityEvent

java.lang.Object
java.util.EventObject
org.apache.wiki.event.WikiEvent
org.apache.wiki.event.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 `LOG` is notified.

These events are logged with priority `ERROR`:

- login failed - bad credential or password

These events are logged with priority `WARN`:

- access denied
- login failed - credential expired
- login failed - account expired

These events are logged with priority `INFO`:

- login succeeded
- logout
- user profile name changed

These events are logged with priority `DEBUG`:

- access allowed
- add group
- remove group
- clear all groups
- add group member
- remove group member
- clear all members from group

Since:
  2.3.79
See Also:
  - Serialized Form

## Field Summary

Fields
Modifier and Type
Field
Description
`static final int`
`ACCESS_ALLOWED`
When access to a resource is allowed.
`static final int`
`ACCESS_DENIED`
When access to a resource is allowed.
`static final int`
`GROUP_ADD`
When a new wiki group is added.
`static final int`
`GROUP_CLEAR_GROUPS`
When all wiki groups are removed from GroupDatabase.
`static final int`
`GROUP_REMOVE`
When a wiki group is deleted.
`static final int`
`LOGIN_ACCOUNT_EXPIRED`
When a login fails due to account expiration.
`static final int`
`LOGIN_ALERT`
Login audit alert, multiple concurrent logins from the different ip addresses .
`static final int`
`LOGIN_ANONYMOUS`
When a user first accesses JSPWiki, but before logging in or setting a cookie.
`static final int`
`LOGIN_ASSERTED`
When a user sets a cookie to assert their identity.
`static final int`
`LOGIN_AUTHENTICATED`
When a user authenticates with a username and password, or via container auth.
`static final int`
`LOGIN_CREDENTIAL_EXPIRED`
When a login fails due to credential expiration.
`static final int`
`LOGIN_FAILED`
When a login fails due to wrong username or password.
`static final int`
`LOGIN_INITIATED`
When a user's attempts to log in as guest, via cookies, using a password or otherwise.
`static final int`
`LOGOUT`
When a user logs out.
`static final int`
`LOW_STORAGE`
When a low disk space is encountered .
`static final int`
`PRINCIPAL_ADD`
When a Principal should be added to the Session
`static final int`
`PROFILE_NAME_CHANGED`
When a user profile name changes.
`static final int`
`PROFILE_SAVE`
When a user profile is saved.
`static final int`
`SESSION_EXPIRED`
When a session expires.

### Fields inherited from class org.apache.wiki.event.WikiEvent

`ERROR, UNDEFINED`

### Fields inherited from class java.util.EventObject

`source`

## Constructor Summary

Constructors
Constructor
Description
`WikiSecurityEvent(Object src, int type, Object target)`
Constructs a new instance of this event type, which signals a security event has occurred.
`WikiSecurityEvent(Object src, int type, Principal principal, Object target)`
Constructs a new instance of this event type, which signals a security event has occurred.

## Method Summary

Modifier and Type
Method
Description
`String`
`eventName(int type)`
Returns a textual representation of an event type.
`Object`
`getPrincipal()`
Returns the principal to whom the operation applied, if supplied.
`Object`
`getTarget()`
Returns the object that was operated on, if supplied.
`String`
`getTypeDescription()`
Returns a human-readable description of the event type.
`String`
`toString()`
Prints a String (human-readable) representation of this object.

### Methods inherited from class org.apache.wiki.event.WikiEvent

`eventName, getArg, getArgs, getAttributes, getSrc, getType, getWhen, isValidType, setType`

### 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 Details

### LOGIN_INITIATED

public static final int LOGIN_INITIATED
When a user's attempts to log in as guest, via cookies, using a password or otherwise.

See Also:
  - Constant Field Values

### LOGIN_ANONYMOUS

public static final int LOGIN_ANONYMOUS
When a user first accesses JSPWiki, but before logging in or setting a cookie.

See Also:
  - Constant Field Values

### LOGIN_ASSERTED

public static final int LOGIN_ASSERTED
When a user sets a cookie to assert their identity.

See Also:
  - Constant Field Values

### 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

### PRINCIPAL_ADD

public static final int PRINCIPAL_ADD
When a Principal should be added to the Session

See Also:
  - Constant Field Values

### SESSION_EXPIRED

public static final int SESSION_EXPIRED
When a session expires.

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 GroupDatabase.

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

### PROFILE_SAVE

public static final int PROFILE_SAVE
When a user profile is saved.

See Also:
  - Constant Field Values

### PROFILE_NAME_CHANGED

public static final int PROFILE_NAME_CHANGED
When a user profile name changes.

See Also:
  - Constant Field Values

### LOW_STORAGE

public static final int LOW_STORAGE
When a low disk space is encountered .

See Also:
  - Constant Field Values

### LOGIN_ALERT

public static final int LOGIN_ALERT
Login audit alert, multiple concurrent logins from the different ip addresses .

See Also:
  - Constant Field Values

## Constructor Details

### WikiSecurityEvent

public WikiSecurityEvent(Object src, 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 `LOG` is notified.

Parameters:
  `src` - 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 src, 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 `LOG` is notified.

Parameters:
  `src` - 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 Details

### getPrincipal

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

Returns:
  the changed object

### getTarget

public 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 String toString()
Prints a String (human-readable) representation of this object.

Overrides:
  `toString` in class `WikiEvent`
Returns:
  the String representation
See Also:
  - `Object.toString()`

### eventName

public String eventName(int type)
Returns a textual representation of an event type.

Parameters:
  `type` - the type
Returns:
  the string representation

### getTypeDescription

public String getTypeDescription()
Returns a human-readable description of the event type.

Overrides:
  `getTypeDescription` in class `WikiEvent`
Returns:
  a String description of the type