Package org.apache.guacamole.net.auth
Class TokenInjectingUserContext
- java.lang.Object
-
- org.apache.guacamole.net.auth.DelegatingUserContext
-
- org.apache.guacamole.net.auth.TokenInjectingUserContext
-
- All Implemented Interfaces:
UserContext
public class TokenInjectingUserContext extends DelegatingUserContext
UserContext implementation which decorates a given UserContext, automatically applying additional parameter tokens during the connection process of any retrieved Connections and ConnectionGroups.
-
-
Constructor Summary
Constructors Constructor Description TokenInjectingUserContext(UserContext userContext)
Wraps the given UserContext, overriding the connect() function of each retrieved Connection and ConnectionGroup such that the additional parameter tokens returned by getTokens() are included.TokenInjectingUserContext(UserContext userContext, Map<String,String> tokens)
Wraps the given UserContext, overriding the connect() function of each retrieved Connection and ConnectionGroup such that the given additional parameter tokens are included.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Directory<Connection>
getConnectionDirectory()
Retrieves a Directory which can be used to view and manipulate connections and their configurations, but only as allowed by the permissions given to the user.Directory<ConnectionGroup>
getConnectionGroupDirectory()
Retrieves a Directory which can be used to view and manipulate connection groups and their members, but only as allowed by the permissions given to the user.protected Map<String,String>
getTokens(Connection connection)
Returns the tokens which should be added to an in-progress call to connect() for the given Connection.protected Map<String,String>
getTokens(ConnectionGroup connectionGroup)
Returns the tokens which should be added to an in-progress call to connect() for the given ConnectionGroup.-
Methods inherited from class org.apache.guacamole.net.auth.DelegatingUserContext
getActiveConnectionDirectory, getAuthenticationProvider, getConnectionAttributes, getConnectionGroupAttributes, getConnectionHistory, getDelegateUserContext, getPrivileged, getResource, getRootConnectionGroup, getSharingProfileAttributes, getSharingProfileDirectory, getUserAttributes, getUserDirectory, getUserGroupAttributes, getUserGroupDirectory, getUserHistory, invalidate, self
-
-
-
-
Constructor Detail
-
TokenInjectingUserContext
public TokenInjectingUserContext(UserContext userContext, Map<String,String> tokens)
Wraps the given UserContext, overriding the connect() function of each retrieved Connection and ConnectionGroup such that the given additional parameter tokens are included. Any additional tokens which have the same name as existing tokens will override the existing values. If tokens specific to a particular connection or connection group need to be included, getTokens() may be overridden to provide a different set of tokens.- Parameters:
userContext
- The UserContext to wrap.tokens
- The additional tokens to include with each call to connect().
-
TokenInjectingUserContext
public TokenInjectingUserContext(UserContext userContext)
Wraps the given UserContext, overriding the connect() function of each retrieved Connection and ConnectionGroup such that the additional parameter tokens returned by getTokens() are included. Any additional tokens which have the same name as existing tokens will override the existing values.- Parameters:
userContext
- The UserContext to wrap.
-
-
Method Detail
-
getTokens
protected Map<String,String> getTokens(Connection connection)
Returns the tokens which should be added to an in-progress call to connect() for the given Connection. If not overridden, this function will return the tokens provided when this instance of TokenInjectingUserContext was created.- Parameters:
connection
- The Connection on which connect() has been called.- Returns:
- The tokens which should be added to the in-progress call to connect().
-
getTokens
protected Map<String,String> getTokens(ConnectionGroup connectionGroup)
Returns the tokens which should be added to an in-progress call to connect() for the given ConnectionGroup. If not overridden, this function will return the tokens provided when this instance of TokenInjectingUserContext was created.- Parameters:
connectionGroup
- The ConnectionGroup on which connect() has been called.- Returns:
- The tokens which should be added to the in-progress call to connect().
-
getConnectionGroupDirectory
public Directory<ConnectionGroup> getConnectionGroupDirectory() throws org.apache.guacamole.GuacamoleException
Description copied from interface:UserContext
Retrieves a Directory which can be used to view and manipulate connection groups and their members, but only as allowed by the permissions given to the user.- Specified by:
getConnectionGroupDirectory
in interfaceUserContext
- Overrides:
getConnectionGroupDirectory
in classDelegatingUserContext
- Returns:
- A Directory whose operations are bound by the permissions of the user.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while creating the Directory.
-
getConnectionDirectory
public Directory<Connection> getConnectionDirectory() throws org.apache.guacamole.GuacamoleException
Description copied from interface:UserContext
Retrieves a Directory which can be used to view and manipulate connections and their configurations, but only as allowed by the permissions given to the user.- Specified by:
getConnectionDirectory
in interfaceUserContext
- Overrides:
getConnectionDirectory
in classDelegatingUserContext
- Returns:
- A Directory whose operations are bound by the permissions of the user.
- Throws:
org.apache.guacamole.GuacamoleException
- If an error occurs while creating the Directory.
-
-