x2gobroker.authmechs.https_get_authmech module

class x2gobroker.authmechs.https_get_authmech.X2GoBrokerAuthMech[source]

Bases: object

X2Go Session Broker’s https_get authentication mechanism:

This authentication mechanism can be attached to a web server that provides some test URL protected by http(s) Basic Authentication.

When the authenticate() function gets called, it attempts to retrieve the test URL via a http(s) GET request. The webserver serving that URL then sends a response back, demanding Authorization.

For the Basic Authorization request that gets sent back to the webserver, the username and password provided by the X2Go client application get used.

authenticate(username, password, config=None, **kwargs)[source]

The https_get authentication mechanism’s authenticate() method attempts authentication against a http(s) server.

It lets broker authentication succeed if the upstream webserver grants authentication to a given test URL. Otherwise, broker authencation fails.

The test URL is provided as set of config parameters passed in via the config function parameter. If no config is given, the default authentication will be performed against http://localhost/auth.

The configuration object provided as config to this method requires to understand this API (a class from module configparser should do this for you):

host = config.get_value('authmech_https_get','host')
path = config.get_value('authmech_https_get','path')
port = config.get_value('authmech_https_get','port')
Parameters:
  • username (str) – The broker username sent by the client
  • password (str) – The broker password sent by the client
  • config – A configparser compliant configuration object
  • type<configparser-like-obj>
  • kwargs (dict) – Any other parameter (for future features’ compatibility, all ignored for now)
Returns:

Authentication success or failure.

Return type:

bool