mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-96: Add API support for augmenting functionality of other extensions.
This commit is contained in:
@@ -107,6 +107,13 @@ public class CASAuthenticationProvider implements AuthenticationProvider {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -102,6 +102,13 @@ public class DuoAuthenticationProvider implements AuthenticationProvider {
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -107,6 +107,13 @@ public class HTTPHeaderAuthenticationProvider implements AuthenticationProvider
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -104,6 +104,13 @@ public abstract class InjectedAuthenticationProvider implements AuthenticationPr
|
|||||||
authenticatedUser, credentials);
|
authenticatedUser, credentials);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -103,6 +103,13 @@ public class LDAPAuthenticationProvider implements AuthenticationProvider {
|
|||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -107,6 +107,13 @@ public class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -168,6 +168,40 @@ public interface AuthenticationProvider {
|
|||||||
AuthenticatedUser authenticatedUser,
|
AuthenticatedUser authenticatedUser,
|
||||||
Credentials credentials) throws GuacamoleException;
|
Credentials credentials) throws GuacamoleException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a UserContext which originates from a different
|
||||||
|
* AuthenticationProvider, returns a UserContext instance which decorates
|
||||||
|
* (wraps) that UserContext, delegating and overriding implemented
|
||||||
|
* functions as necessary. Each UserContext created via getUserContext()
|
||||||
|
* or updateUserContext() will be passed to the decorate() functions of all
|
||||||
|
* other AuthenticationProviders, allowing those AuthenticationProviders
|
||||||
|
* to augment (or perhaps even limit) the functionality or data provided.
|
||||||
|
*
|
||||||
|
* @param context
|
||||||
|
* An existing UserContext generated by a different
|
||||||
|
* AuthenticationProvider.
|
||||||
|
*
|
||||||
|
* @param authenticatedUser
|
||||||
|
* The AuthenticatedUser object representing the user associated with
|
||||||
|
* the given UserContext.
|
||||||
|
*
|
||||||
|
* @param credentials
|
||||||
|
* The credentials which were most recently submitted for the given
|
||||||
|
* AuthenticatedUser. These are not guaranteed to be the same as the
|
||||||
|
* credentials associated with the AuthenticatedUser object, which are
|
||||||
|
* the credentials provided when the user originally authenticated.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* A decorated (wrapped) UserContext object, or the original,
|
||||||
|
* undecorated UserContext.
|
||||||
|
*
|
||||||
|
* @throws GuacamoleException
|
||||||
|
* If the UserContext cannot be decorated due to an error.
|
||||||
|
*/
|
||||||
|
UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser,
|
||||||
|
Credentials credentials) throws GuacamoleException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Frees all resources associated with this AuthenticationProvider. This
|
* Frees all resources associated with this AuthenticationProvider. This
|
||||||
* function will be automatically invoked when the Guacamole server is
|
* function will be automatically invoked when the Guacamole server is
|
||||||
|
@@ -260,6 +260,16 @@ public abstract class SimpleAuthenticationProvider
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser, Credentials credentials)
|
||||||
|
throws GuacamoleException {
|
||||||
|
|
||||||
|
// Simply return the given context, decorating nothing
|
||||||
|
return context;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
// Do nothing
|
// Do nothing
|
||||||
|
@@ -158,6 +158,20 @@ public class AuthenticationProviderFacade implements AuthenticationProvider {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UserContext decorate(UserContext context,
|
||||||
|
AuthenticatedUser authenticatedUser,
|
||||||
|
Credentials credentials) throws GuacamoleException {
|
||||||
|
|
||||||
|
// Do nothing if underlying auth provider could not be loaded
|
||||||
|
if (authProvider == null)
|
||||||
|
return context;
|
||||||
|
|
||||||
|
// Delegate to underlying auth provider
|
||||||
|
return authProvider.decorate(context, authenticatedUser, credentials);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
if (authProvider != null)
|
if (authProvider != null)
|
||||||
|
Reference in New Issue
Block a user