Create CredentialEvent interface for generic credentials-related events. Implemented AuthenticationFailureEvent.

This commit is contained in:
Michael Jumper
2012-03-23 11:02:47 -07:00
parent e58a4fc52b
commit 898cee122f
2 changed files with 55 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package net.sourceforge.guacamole.net.event;
import net.sourceforge.guacamole.net.auth.Credentials;
/**
* An event which is triggered whenever a user's credentials fail to be
* authenticated. The credentials that failed to be authenticated are included
* within this event, and can be retrieved using getCredentials().
*
* @author Michael Jumper
*/
public class AuthenticationFailureEvent implements CredentialEvent {
/**
* The credentials which failed authentication
*/
private Credentials credentials;
/**
* Creates a new AuthenticationFailureEvent which represents the failure
* to authenticate the given credentials.
*
* @param credentials The credentials which failed authentication.
*/
public AuthenticationFailureEvent(Credentials credentials) {
this.credentials = credentials;
}
@Override
public Credentials getCredentials() {
return credentials;
}
}

View File

@@ -0,0 +1,21 @@
package net.sourceforge.guacamole.net.event;
import net.sourceforge.guacamole.net.auth.Credentials;
/**
* Abstract basis for events which may have associated user credentials when
* triggered.
*
* @author Michael Jumper
*/
public interface CredentialEvent {
/**
* Returns the current credentials of the user triggering the event, if any.
*
* @return The current credentials of the user triggering the event, if
* any, or null if no credentials are associated with the event.
*/
public Credentials getCredentials();
}