On 11/20/2023 1:25 PM, Kai wrote:
I made some further analyzing of the sources in order to understand the structur of a plugin..

The nearest extension I could find was guacamole-history-recording-storage.
I took this as starting point and created a classProxmoxAuthenticationProviderextendsAbstractAuthenticationProvider

As shown in the extension I made a function call to decorate:
publicUserContextdecorate(UserContextcontext,
AuthenticatedUserauthenticatedUser, Credentialscredentials)
throwsGuacamoleException{
returnnewProxmoxUserContext(context.self(), context);
}

That got to the classProxmoxUserContextextendsTokenInjectingUserContext
privatestaticfinalLoggerlogger=LoggerFactory.getLogger(ProxmoxUserContext.class);
publicProxmoxUserContext(UsercurrentUser, UserContextcontext) {
super(context);
this.currentUser=currentUser;
logger.warn("ProxmoxUserContext() ");
}

I got this to compile as a .jar file and included it into Guacamole.

Getting the log, I saw that this plugin is loaded: "INFO  o.a.g.extension.ExtensionModule - Extension "Proxmox machine start/stop" (proxmox) loaded."

I was expecting that my logger message would be shown at some point. When would this extension be called?

The function in question would be called after a successful login. You would see the message once for every UserContext associated with the user's session.

Here is how the authentication and authorization flow works:

(1) When a user attempts to log in, every installed extension is given an opportunity to accept or reject that attempt. If an extension accepts the attempt, it returns an AuthenticatedUser via its authenticateUser() function.

(2) The AuthenticatedUser representing the user's now-validated identity is given to each installed extension via getUserContext(). Each extension now has the opportunity to provide data for that user via its own UserContext.

(3) For each UserContext obtained in this way, each extension's decorate() function is invoked to allow those extensions to apply their own behavior around whatever is already provided by the UserContexts of other extensions.

The UI presented to the user after they successfully log in is actually a transparently unified view of all the data available from however many UserContext objects apply to that user's session.

- Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@guacamole.apache.org
For additional commands, e-mail: user-h...@guacamole.apache.org

Reply via email to