x2go.backends.profiles.httpbroker module

x2go.backends.profiles.httpbroker.X2GoSessionProfiles class - managing X2Go Client session profiles obtain from an HTTP based X2Go Session Broker.

x2go.backends.profiles.httpbroker.X2GoSessionProfiles is a public API class. Use this class in your Python X2Go based applications.

class x2go.backends.profiles.httpbroker.X2GoSessionProfiles(session_profile_defaults=None, broker_url='http://localhost:8080/json/', broker_username=None, broker_password=None, logger=None, loglevel=56, **kwargs)[source]

Bases: x2go.backends.profiles.base.X2GoSessionProfiles

broker_disconnect()[source]

Disconnect from an (already) authenticated broker session.

All authentication parameters will be dropped (forgotten) and this instance has to re-authenticate against / re-connect to the session broker before any new interaction with the broker is possible.

broker_listprofiles()[source]

Obtain a session profile list from the X2Go Session Broker.

Returns:session profiles as a Python dictionary.
Return type:dict
broker_selectsession(profile_id)[source]

Select a session from the list of available session profiles (presented by broker_listprofiles()). This method requests a session information dictionary (server, port, SSH keys, already running / suspended sessions, etc.) from the session broker for the provided profile_id.

Parameters:profile_id (str) – profile ID of the selected session profile
Returns:session information (server, port, SSH keys, etc.) for a selected session profile (i.e. profile_id)
Return type:dict
broker_simpleauth(broker_username, broker_password)[source]

Attempt a username / password authentication against the instance’s broker URL.

Parameters:
  • broker_username (str) – username to use for authentication
  • broker_password (str) – password to use for authentication
Returns:

True if authentication has been successful

Return type:

bool

Raises:

X2GoBrokerConnectionException – Raised on any kind of connection / authentication failure.

defaultSessionProfile = {'mimeboxextensions': '', 'print': False, 'directrdpsettings': '', 'display': 1, 'autostart': False, 'forwardsshagent': False, 'sessiontitle': '', 'rdpoptions': '-u X2GO_USER -p X2GO_PASSWORD', 'iconvfrom': 'UTF-8', 'published': False, 'usesshproxy': False, 'host': ['server.mydomain'], 'command': 'TERMINAL', 'setdpi': False, 'sshproxyuser': '', 'xdmcpserver': 'localhost', 'rdpserver': '', 'directrdp': False, 'export': {}, 'width': 800, 'clipboard': 'both', 'icon': ':icons/128x128/x2gosession.png', 'sound': False, 'rootless': True, 'uniquehostkeyaliases': False, 'sshproxykeyfile': '', 'setsessiontitle': False, 'sshproxyautologin': True, 'fstunnel': True, 'user': 'mike', 'pack': '16m-jpeg', 'applications': ['WWWBROWSER', 'MAILCLIENT', 'OFFICE', 'TERMINAL'], 'mimeboxaction': 'OPEN', 'usemimebox': False, 'variant': '', 'autologin': True, 'maxdim': False, 'key': '', 'useiconv': False, 'startsoundsystem': False, 'usekbd': True, 'sshport': 22, 'dpi': 96, 'sshproxytype': 'SSH', 'type': 'pc105/us', 'speed': 2, 'useexports': True, 'defsndport': True, 'sshproxyport': 22, 'restoreexports': False, 'quality': 9, 'xinerama': False, 'fullscreen': False, 'sndport': 4713, 'height': 600, 'name': 'NEW_PROFILE', 'rdpport': 3389, 'krblogin': False, 'multidisp': False, 'autoconnect': False, 'iconvto': 'UTF-8', 'soundtunnel': True, 'sshproxysamepass': False, 'soundsystem': 'pulse', 'layout': 'us', 'rdpclient': 'rdesktop', 'sshproxyhost': 'proxyhost.mydomain', 'sshproxysameuser': False}
get_broker_noauth()[source]

Accessor for the class’s broker_noauth property.

Returns:True if the broker probably does not expect authentication.
Return type:bool
get_broker_type()[source]

Accessor of the class’s {_broker_type} property.

Returns:either http or https.
Return type:str
get_broker_url()[source]

Accessor for the class’s broker_url property.

Returns:the session broker URL that was used at broker session instantiation
Return type:str
get_broker_username()[source]

Accessor for the class’s broker_username property.

Returns:the username used for authentication against the session broker URL
Return type:str
is_broker_authenticated()[source]

Detect if an authenticated broker session has already been initiated. Todo so, a simple re-authentication (username, password) will be attempted. If that fails, user credentials are not provided / valid.

Returns:True if the broker session has already been authenticated and user credentials are known / valid
Return type:bool
set_broker_url(broker_url)[source]

Mutator for the class’s broker_url property.

Parameters:broker_url (str) – A new broker URL to use with this instance. Format is <protocol>://<hostname>:<port>/<path> (where protocol has to be http or https.
Returns:the session broker URL that was used at broker session instantiation
Return type:str