Class SimpleUserContext
- java.lang.Object
-
- org.apache.guacamole.net.auth.AbstractUserContext
-
- org.apache.guacamole.net.auth.simple.SimpleUserContext
-
- All Implemented Interfaces:
UserContext
public class SimpleUserContext extends AbstractUserContext
An extremely simple UserContext implementation which provides access to a defined and restricted set of GuacamoleConfigurations. Access to querying or modifying either users or permissions is denied.
-
-
Field Summary
-
Fields inherited from class org.apache.guacamole.net.auth.AbstractUserContext
DEFAULT_ROOT_CONNECTION_GROUP
-
-
Constructor Summary
Constructors Constructor Description SimpleUserContext(AuthenticationProvider authProvider, String username, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs)
Creates a new SimpleUserContext for the user with the given username which provides access to only those configurations within the given Map.SimpleUserContext(AuthenticationProvider authProvider, String username, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs, boolean interpretTokens)
Creates a new SimpleUserContext for the user with the given username which provides access to only those configurations within the given Map.SimpleUserContext(AuthenticationProvider authProvider, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs)
Creates a new SimpleUserContext which provides access to only those configurations within the given Map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuthenticationProvider
getAuthenticationProvider()
Returns the AuthenticationProvider which created this UserContext, which may not be the same AuthenticationProvider that authenticated the user associated with this UserContext.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.Object
getResource()
Returns an arbitrary REST resource representing this UserContext.User
self()
Returns the User whose access rights control the operations of this UserContext.-
Methods inherited from class org.apache.guacamole.net.auth.AbstractUserContext
getActiveConnectionDirectory, getConnectionAttributes, getConnectionGroupAttributes, getConnectionGroupDirectory, getConnectionHistory, getPrivileged, getRootConnectionGroup, getSharingProfileAttributes, getSharingProfileDirectory, getUserAttributes, getUserDirectory, getUserGroupAttributes, getUserGroupDirectory, getUserHistory, invalidate
-
-
-
-
Constructor Detail
-
SimpleUserContext
public SimpleUserContext(AuthenticationProvider authProvider, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs)
Creates a new SimpleUserContext which provides access to only those configurations within the given Map. The username is set to the ANONYMOUS_IDENTIFIER defined by AuthenticatedUser, effectively declaring the current user as anonymous. Parameter tokens within the given GuacamoleConfigurations will not be interpreted.- Parameters:
authProvider
- The AuthenticationProvider creating this UserContext.configs
- A Map of all configurations for which the user associated with this UserContext has read access.
-
SimpleUserContext
public SimpleUserContext(AuthenticationProvider authProvider, String username, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs)
Creates a new SimpleUserContext for the user with the given username which provides access to only those configurations within the given Map. Parameter tokens within the given GuacamoleConfigurations will not be interpreted.- Parameters:
authProvider
- The AuthenticationProvider creating this UserContext.username
- The username of the user associated with this UserContext.configs
- A Map of all configurations for which the user associated with this UserContext has read access.
-
SimpleUserContext
public SimpleUserContext(AuthenticationProvider authProvider, String username, Map<String,org.apache.guacamole.protocol.GuacamoleConfiguration> configs, boolean interpretTokens)
Creates a new SimpleUserContext for the user with the given username which provides access to only those configurations within the given Map. Parameter tokens within the given GuacamoleConfigurations will be interpreted if explicitly requested.- Parameters:
authProvider
- The AuthenticationProvider creating this UserContext.username
- The username of the user associated with this UserContext.configs
- A Map of all configurations for which the user associated with this UserContext has read access.interpretTokens
- Whether parameter tokens in the underlying GuacamoleConfigurations should be automatically applied upon connecting. If false, parameter tokens will not be interpreted at all.
-
-
Method Detail
-
self
public User self()
Description copied from interface:UserContext
Returns the User whose access rights control the operations of this UserContext.- Returns:
- The User whose access rights control the operations of this UserContext.
-
getResource
public Object getResource() throws org.apache.guacamole.GuacamoleException
Description copied from class:AbstractUserContext
Returns an arbitrary REST resource representing this UserContext. The REST resource returned must be properly annotated with JSR-311 annotations, and may serve as the root resource for any number of subresources. The returned resource is ultimately exposed at ".../api/session/ext/IDENTIFIER/", where IDENTIFIER is the identifier of the AuthenticationProvider associated with this UserContext. REST resources returned by this function will only be reachable by authenticated users with valid authentication tokens. REST resources which should be accessible by all users regardless of whether they have authenticated should instead be returned from AuthenticationProvider.getResource().This implementation simply returns
null
. Implementations that wish to expose REST resources specific to a user's session should override this function.- Specified by:
getResource
in interfaceUserContext
- Overrides:
getResource
in classAbstractUserContext
- Returns:
- An arbitrary REST resource, annotated with JSR-311 annotations, or null if no such resource is defined.
- Throws:
org.apache.guacamole.GuacamoleException
- If the REST resource cannot be returned due to an error.
-
getAuthenticationProvider
public AuthenticationProvider getAuthenticationProvider()
Description copied from interface:UserContext
Returns the AuthenticationProvider which created this UserContext, which may not be the same AuthenticationProvider that authenticated the user associated with this UserContext.- Returns:
- The AuthenticationProvider that created this UserContext.
-
getConnectionDirectory
public Directory<Connection> getConnectionDirectory() throws org.apache.guacamole.GuacamoleException
Description copied from class:AbstractUserContext
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.This implementation simply returns an empty
Directory
. Implementations that wish to expose connections should override this function.- Specified by:
getConnectionDirectory
in interfaceUserContext
- Overrides:
getConnectionDirectory
in classAbstractUserContext
- 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.
-
-