On Mon, Nov 1, 2021 at 3:37 PM Dustin Lang <[email protected]> wrote:

> Hi Nick,
>
> Thanks for your reply.  But I'm confused -- in
> updateAuthenticatedUser(AuthenticatedUser, Credentials), how can I get the
> current UserContext object associated with that auth user?
> SimpleAuthenticatedUser is a private class in SimpleAuthenticationProvider,
> otherwise I could cast it and .getAuthorizedConfigurations()...
>

For the UserContext, there is a separate updateUserContext() function that
receives the previous UserContext instance:

https://guacamole.apache.org/doc/1.3.0/guacamole-ext/org/apache/guacamole/net/auth/AuthenticationProvider.html#updateUserContext-org.apache.guacamole.net.auth.UserContext-org.apache.guacamole.net.auth.AuthenticatedUser-org.apache.guacamole.net.auth.Credentials-

You can't otherwise directly obtain the single UserContext associated with
the AuthenticatedUser because there is no such thing - the relationship
between the AuthenticatedUser and the UserContext(s) is one-to-many, with
each extension having the opportunity to provide their own UserContext for
the AuthenticatedUser instance that may come from another extension. The
interface presented to the user will be a transparently unified view of all
the UserContexts associated with their Guacamole session.

You also do not have to implement updateUserContext() unless the data
exposed by your UserContext implementation needs to change relative to
newly-submitted credentials. Your UserContext can be dynamic and produce
differing sets of connections, users, etc. based on external factors that
are independent of user credentials, such as the contents of a database or
the contents of a REST request to some other service. It's also possible to
have the internal result of attempting to connect to a Connection vary
dynamically - you don't need to bake in static configuration and data ahead
of time, changing things only when an explicit update call occurs.

Beware that the results of REST API requests to Guacamole are cached by the
web application, so if you have confirmed that you are updating your
UserContext but are simply not seeing the results of those updates in the
UI, it may just be that you're seeing the old cached data.

Michael Jumper
CEO, Lead Developer
Glyptodon Inc <https://glyp.to/>.

>

Reply via email to