GUACAMOLE-96: Add redecorate() function with semantics analogous to updateUserContext().

This commit is contained in:
Michael Jumper
2017-10-28 19:12:05 -07:00
parent a745569f13
commit 7357e51b58
13 changed files with 531 additions and 61 deletions

View File

@@ -169,16 +169,16 @@ public interface AuthenticationProvider {
Credentials credentials) throws GuacamoleException;
/**
* Given a UserContext which originates from a different
* Given a UserContext returned from getUserContext() of 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.
* 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
* An existing UserContext generated by getUserContext() of a different
* AuthenticationProvider.
*
* @param authenticatedUser
@@ -202,6 +202,45 @@ public interface AuthenticationProvider {
AuthenticatedUser authenticatedUser,
Credentials credentials) throws GuacamoleException;
/**
* Given a UserContext returned by updateUserContext() of a different
* AuthenticationProvider, returns a UserContext instance which decorates
* (wraps) that UserContext, delegating and overriding implemented
* functions as necessary. Each UserContext created via 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 decorated
* The UserContext returned when decorate() was invoked on this
* AuthenticationProvider for the UserContext which was just updated
* via a call to updateUserContext().
*
* @param context
* An existing UserContext generated by updateUserContext() of 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 redecorate(UserContext decorated, UserContext context,
AuthenticatedUser authenticatedUser,
Credentials credentials) throws GuacamoleException;
/**
* Frees all resources associated with this AuthenticationProvider. This
* function will be automatically invoked when the Guacamole server is

View File

@@ -270,6 +270,13 @@ public abstract class SimpleAuthenticationProvider
}
@Override
public UserContext redecorate(UserContext decorated, UserContext context,
AuthenticatedUser authenticatedUser, Credentials credentials)
throws GuacamoleException {
return decorate(context, authenticatedUser, credentials);
}
@Override
public void shutdown() {
// Do nothing