swh.web.client.auth module

exception swh.web.client.auth.AuthenticationError[source]

Bases: Exception

Authentication related error.

Example: A bearer token has been revoked.

class swh.web.client.auth.OpenIDConnectSession(oidc_server_url: str = 'https://auth.softwareheritage.org/auth/', realm_name: str = 'SoftwareHeritage', client_id: str = 'swh-web')[source]

Bases: object

Simple class wrapping requests sent to an OpenID Connect server.

  • oidc_server_url – URL of OpenID Connect server

  • realm_name – name of the OpenID Connect authentication realm

  • client_id – OpenID Connect client identifier in the realm

login(username: str, password: str) → Dict[str, Any][source]

Login and create new offline OpenID Connect session.

  • username – an existing username in the realm

  • password – password associated to username


The OpenID Connect session info

logout(token: str)[source]

Logout from an offline OpenID Connect session and invalidate previously emitted tokens.


token – a bearer token retrieved after login