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:
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 providedprofile_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 authenticationbroker_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 = {'applications': ['WWWBROWSER', 'MAILCLIENT', 'OFFICE', 'TERMINAL'], 'autoconnect': False, 'autologin': True, 'autostart': False, 'clipboard': 'both', 'command': 'TERMINAL', 'defsndport': True, 'directrdp': False, 'directrdpsettings': '', 'display': 1, 'dpi': 96, 'export': {}, 'forwardsshagent': False, 'fstunnel': True, 'fullscreen': False, 'height': 600, 'host': ['server.mydomain'], 'icon': ':icons/128x128/x2gosession.png', 'iconvfrom': 'UTF-8', 'iconvto': 'UTF-8', 'kdrive': False, 'key': '', 'krblogin': False, 'layout': 'us', 'maxdim': False, 'mimeboxaction': 'OPEN', 'mimeboxextensions': '', 'multidisp': False, 'name': 'NEW_PROFILE', 'pack': '16m-jpeg', 'print': False, 'published': False, 'quality': 9, 'rdpclient': 'rdesktop', 'rdpoptions': '-u X2GO_USER -p X2GO_PASSWORD', 'rdpport': 3389, 'rdpserver': '', 'restoreexports': False, 'rootless': True, 'sessiontitle': '', 'setdpi': False, 'setsessiontitle': False, 'sndport': 4713, 'sound': False, 'soundsystem': 'pulse', 'soundtunnel': True, 'speed': 2, 'sshport': 22, 'sshproxyautologin': True, 'sshproxyhost': 'proxyhost.mydomain', 'sshproxykeyfile': '', 'sshproxyport': 22, 'sshproxysamepass': False, 'sshproxysameuser': False, 'sshproxytype': 'SSH', 'sshproxyuser': '', 'startsoundsystem': False, 'type': 'pc105/us', 'uniquehostkeyaliases': False, 'useexports': True, 'useiconv': False, 'usekbd': True, 'usemimebox': False, 'user': 'mockbuild', 'usesshproxy': False, 'variant': '', 'width': 800, 'xdmcpserver': 'localhost', 'xinerama': 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
orhttps
.- 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 behttp
orhttps
.- Returns:
the session broker URL that was used at broker session instantiation
- Return type:
str