mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
GUACAMOLE-412: Refactor user events with respect to extension API changes since the decoupling of auth from storage, providing AuthenticatedUser instead of UserContext to represent the user involved.
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
package org.apache.guacamole.net.event;
|
||||
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* An event which is triggered whenever a user's credentials pass
|
||||
@@ -35,37 +35,32 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
public class AuthenticationSuccessEvent implements UserEvent, CredentialEvent {
|
||||
|
||||
/**
|
||||
* The UserContext associated with the request that is connecting the
|
||||
* tunnel, if any.
|
||||
* The AuthenticatedUser identifying the user that successfully
|
||||
* authenticated.
|
||||
*/
|
||||
private UserContext context;
|
||||
|
||||
/**
|
||||
* The credentials which passed authentication.
|
||||
*/
|
||||
private Credentials credentials;
|
||||
private final AuthenticatedUser authenticatedUser;
|
||||
|
||||
/**
|
||||
* Creates a new AuthenticationSuccessEvent which represents a successful
|
||||
* authentication attempt with the given credentials.
|
||||
* authentication attempt by the user identified by the given
|
||||
* AuthenticatedUser object.
|
||||
*
|
||||
* @param context The UserContext created as a result of successful
|
||||
* authentication.
|
||||
* @param credentials The credentials which passed authentication.
|
||||
* @param authenticatedUser
|
||||
* The AuthenticatedUser identifying the user that successfully
|
||||
* authenticated.
|
||||
*/
|
||||
public AuthenticationSuccessEvent(UserContext context, Credentials credentials) {
|
||||
this.context = context;
|
||||
this.credentials = credentials;
|
||||
public AuthenticationSuccessEvent(AuthenticatedUser authenticatedUser) {
|
||||
this.authenticatedUser = authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext() {
|
||||
return context;
|
||||
public AuthenticatedUser getAuthenticatedUser() {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Credentials getCredentials() {
|
||||
return credentials;
|
||||
return authenticatedUser.getCredentials();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -20,8 +20,8 @@
|
||||
package org.apache.guacamole.net.event;
|
||||
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
/**
|
||||
* An event which is triggered whenever a tunnel is being closed. The tunnel
|
||||
@@ -36,42 +36,48 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
public class TunnelCloseEvent implements UserEvent, CredentialEvent, TunnelEvent {
|
||||
|
||||
/**
|
||||
* The UserContext associated with the request that is closing the
|
||||
* The AuthenticatedUser associated with the user that is closing the
|
||||
* tunnel, if any.
|
||||
*/
|
||||
private UserContext context;
|
||||
private final AuthenticatedUser authenticatedUser;
|
||||
|
||||
/**
|
||||
* The credentials associated with the request that connected the
|
||||
* tunnel, if any.
|
||||
* The credentials associated with the request that closed the tunnel, if
|
||||
* any.
|
||||
*/
|
||||
private Credentials credentials;
|
||||
private final Credentials credentials;
|
||||
|
||||
/**
|
||||
* The tunnel being closed.
|
||||
*/
|
||||
private GuacamoleTunnel tunnel;
|
||||
private final GuacamoleTunnel tunnel;
|
||||
|
||||
/**
|
||||
* Creates a new TunnelCloseEvent which represents the closing of the
|
||||
* given tunnel via a request associated with the given credentials.
|
||||
*
|
||||
* @param context The UserContext associated with the request closing
|
||||
* the tunnel.
|
||||
* @param credentials The credentials associated with the request that
|
||||
* connected the tunnel.
|
||||
* @param tunnel The tunnel being closed.
|
||||
* @param authenticatedUser
|
||||
* The AuthenticatedUser associated with the user that is closing the
|
||||
* tunnel, if any.
|
||||
*
|
||||
* @param credentials
|
||||
* The credentials associated with the request that closed the
|
||||
* tunnel. Note that these credentials are not necessarily the same as
|
||||
* the credentials provided when the user authenticated.
|
||||
*
|
||||
* @param tunnel
|
||||
* The tunnel being closed.
|
||||
*/
|
||||
public TunnelCloseEvent(UserContext context, Credentials credentials,
|
||||
GuacamoleTunnel tunnel) {
|
||||
this.context = context;
|
||||
public TunnelCloseEvent(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials, GuacamoleTunnel tunnel) {
|
||||
this.authenticatedUser = authenticatedUser;
|
||||
this.credentials = credentials;
|
||||
this.tunnel = tunnel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext() {
|
||||
return context;
|
||||
public AuthenticatedUser getAuthenticatedUser() {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,6 +20,7 @@
|
||||
package org.apache.guacamole.net.event;
|
||||
|
||||
import org.apache.guacamole.net.GuacamoleTunnel;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
import org.apache.guacamole.net.auth.Credentials;
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
|
||||
@@ -36,42 +37,47 @@ import org.apache.guacamole.net.auth.UserContext;
|
||||
public class TunnelConnectEvent implements UserEvent, CredentialEvent, TunnelEvent {
|
||||
|
||||
/**
|
||||
* The UserContext associated with the request that is connecting the
|
||||
* The AuthenticatedUser associated with the user that is connecting the
|
||||
* tunnel, if any.
|
||||
*/
|
||||
private UserContext context;
|
||||
private final AuthenticatedUser authenticatedUser;
|
||||
|
||||
/**
|
||||
* The credentials associated with the request that is connecting the
|
||||
* tunnel, if any.
|
||||
*/
|
||||
private Credentials credentials;
|
||||
private final Credentials credentials;
|
||||
|
||||
/**
|
||||
* The tunnel being connected.
|
||||
*/
|
||||
private GuacamoleTunnel tunnel;
|
||||
private final GuacamoleTunnel tunnel;
|
||||
|
||||
/**
|
||||
* Creates a new TunnelConnectEvent which represents the connecting of the
|
||||
* given tunnel via a request associated with the given credentials.
|
||||
*
|
||||
* @param context The UserContext associated with the request connecting
|
||||
* the tunnel.
|
||||
* @param credentials The credentials associated with the request connecting
|
||||
* the tunnel.
|
||||
* @param authenticatedUser
|
||||
* The AuthenticatedUser associated with the user that is connecting the
|
||||
* tunnel, if any.
|
||||
*
|
||||
* @param credentials
|
||||
* The credentials associated with the request that connected the
|
||||
* tunnel. Note that these credentials are not necessarily the same as
|
||||
* the credentials provided when the user authenticated.
|
||||
*
|
||||
* @param tunnel The tunnel being connected.
|
||||
*/
|
||||
public TunnelConnectEvent(UserContext context, Credentials credentials,
|
||||
GuacamoleTunnel tunnel) {
|
||||
this.context = context;
|
||||
public TunnelConnectEvent(AuthenticatedUser authenticatedUser,
|
||||
Credentials credentials, GuacamoleTunnel tunnel) {
|
||||
this.authenticatedUser = authenticatedUser;
|
||||
this.credentials = credentials;
|
||||
this.tunnel = tunnel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserContext getUserContext() {
|
||||
return context;
|
||||
public AuthenticatedUser getAuthenticatedUser() {
|
||||
return authenticatedUser;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -19,20 +19,22 @@
|
||||
|
||||
package org.apache.guacamole.net.event;
|
||||
|
||||
import org.apache.guacamole.net.auth.UserContext;
|
||||
import org.apache.guacamole.net.auth.AuthenticatedUser;
|
||||
|
||||
/**
|
||||
* Abstract basis for events which may have an associated UserContext when
|
||||
* Abstract basis for events which may have an associated AuthenticatedUser when
|
||||
* triggered.
|
||||
*/
|
||||
public interface UserEvent {
|
||||
|
||||
/**
|
||||
* Returns the current UserContext of the user triggering the event, if any.
|
||||
* Returns the AuthenticatedUser identifying the user triggering the event,
|
||||
* if any.
|
||||
*
|
||||
* @return The current UserContext of the user triggering the event, if
|
||||
* any, or null if no UserContext is associated with the event.
|
||||
* @return
|
||||
* The AuthenticatedUser identifying the user triggering the event, if
|
||||
* any, or null if no AuthenticatedUser is associated with the event.
|
||||
*/
|
||||
UserContext getUserContext();
|
||||
AuthenticatedUser getAuthenticatedUser();
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user