Package x2go :: Package backends :: Package profiles :: Module httpbroker :: Class X2GoSessionProfiles

[frames] | no frames]

# Class X2GoSessionProfiles

source code

    base.X2GoSessionProfiles --+
                               |
                              X2GoSessionProfiles

Instance Methods

__init__(self, session_profile_defaults=None, broker_url="http://localhost:8080/json/", broker_username=None, broker_password=None, logger=None, loglevel=log.loglevel_DEFAULT, **kwargs) Retrieve X2Go session profiles from a HTTP(S) session broker. | source code

`bool`

get_broker_noauth(self) Accessor for the class's `broker_noauth` property. | source code

`str`

get_broker_username(self) Accessor for the class's `broker_username` property. | source code

`str`

get_broker_url(self) Accessor for the class's `broker_url` property. | source code

`str`

set_broker_url(self, broker_url) Mutator for the class's `broker_url` property. | source code

`str`

get_broker_type(self) Accessor of the class's {_broker_type} property. | source code

`bool`

broker_simpleauth(self, broker_username, broker_password) Attempt a username / password authentication against the instance's broker URL. | source code

broker_disconnect(self) Disconnect from an (already) authenticated broker session. | source code

`bool`

is_broker_authenticated(self) Detect if an authenticated broker session has already been initiated. | source code

`dict`

broker_listprofiles(self) Obtain a session profile list from the X2Go Session Broker. | source code

`dict`

broker_selectsession(self, profile_id) Select a session from the list of available session profiles (presented by broker_listprofiles). | source code

Inherited from `base.X2GoSessionProfiles`: `__call__`, `add_profile`, `check_profile_id_or_name`, `default_profile_config`, `delete_profile`, `get_pkey_object`, `get_profile_config`, `get_profile_metatype`, `get_profile_option_type`, `get_server_hostname`, `get_server_port`, `get_session_param`, `has_profile`, `has_profile_id`, `has_profile_name`, `init_profile_cache`, `is_mutable`, `mutable_profile_ids`, `populate_session_profiles`, `supports_mutable_profiles`, `to_profile_id`, `to_profile_name`, `to_session_params`, `update_value`, `write`

Class Variables
| defaultSessionProfile = `copy.deepcopy(_X2GO_SESSIONPROFILE_DEF`...``

Properties
Inherited from `base.X2GoSessionProfiles`: `profile_ids`, `profile_names`

Method Details

### __init__(self, session_profile_defaults=None, broker_url="http://localhost:8080/json/", broker_username=None, broker_password=None, logger=None, loglevel=log.loglevel_DEFAULT, **kwargs)
(Constructor)

source code

Retrieve X2Go session profiles from a HTTP(S) session broker.

Parameters:
  - `session_profile_defaults` (`dict`) - a default session profile
  - `broker_url` (`str`) - URL for accessing the X2Go Session Broker
  - `broker_password` (`str`) - use this password for authentication against the X2Go Session Broker (avoid password string in the `broker_URL` parameter is highly recommended)
  - `logger` (X2GoLogger instance) - you can pass an X2GoLogger object to the x2go.backends.profiles.httpbroker.X2GoSessionProfiles constructor
  - `loglevel` (`int`) - if no X2GoLogger object has been supplied a new one will be constructed with the given loglevel
Overrides: base.X2GoSessionProfiles.__init__

### get_broker_noauth(self)

source code

Accessor for the class's `broker_noauth` property.

Returns: `bool`
  `True` if the broker probably does not expect authentication.

### get_broker_username(self)

source code

Accessor for the class's `broker_username` property.

Returns: `str`
  the username used for authentication against the session broker URL

### get_broker_url(self)

source code

Accessor for the class's `broker_url` property.

Returns: `str`
  the session broker URL that was used at broker session instantiation

### set_broker_url(self, broker_url)

source code

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: `str`
  the session broker URL that was used at broker session instantiation

### get_broker_type(self)

source code

Accessor of the class's {_broker_type} property.

Returns: `str`
  either `http` or `https`.

### broker_simpleauth(self, broker_username, broker_password)

source code

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: `bool`
  `True` if authentication has been successful
Raises:
  - `X2GoBrokerConnectionException` - Raised on any kind of connection / authentication failure.

### broker_disconnect(self)

source code

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.

### is_broker_authenticated(self)

source code

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: `bool`
  `True` if the broker session has already been authenticated and user credentials are known / valid

### broker_listprofiles(self)

source code

Obtain a session profile list from the X2Go Session Broker.

Returns: `dict`
  session profiles as a Python dictionary.

### broker_selectsession(self, profile_id)

source code

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: `dict`
  session information (server, port, SSH keys, etc.) for a selected session profile (i.e. `profile_id`)

Class Variable Details

### defaultSessionProfile

Value:

      copy.deepcopy(_X2GO_SESSIONPROFILE_DEFAULTS)