sgr_commhandler.driver.rest.authentication

Provides HTTP/REST authentication methods.

Attributes

logger

supported_authentication_methods

Functions

authenticate_not(interface, session)

Skips authentication.

authenticate_with_bearer_token(interface, session)

Authenticates using Bearer token (JWT).

authenticate_with_basic_auth(interface, session)

Authenticates using Basic Authentication.

setup_authentication(rest_api_interface, session)

Performs authentication asynchronously, depending on the configured method.

Module Contents

sgr_commhandler.driver.rest.authentication.logger
async sgr_commhandler.driver.rest.authentication.authenticate_not(interface, session)

Skips authentication.

Parameters:
  • interface (RestApiInterface) – the device interface

  • session (ClientSession) – the REST client session

Returns:

True if authenticated, False otherwise

Return type:

bool

async sgr_commhandler.driver.rest.authentication.authenticate_with_bearer_token(interface, session)

Authenticates using Bearer token (JWT).

Parameters:
  • interface (RestApiInterface) – the device interface

  • session (ClientSession) – the REST client session

Returns:

True if authenticated, False otherwise

Return type:

bool

async sgr_commhandler.driver.rest.authentication.authenticate_with_basic_auth(interface, session)

Authenticates using Basic Authentication.

Parameters:
  • interface (RestApiInterface) – the device interface

  • session (ClientSession) – the REST client session

Returns:

True if authenticated, False otherwise

Return type:

bool

sgr_commhandler.driver.rest.authentication.supported_authentication_methods: dict[sgr_specification.v0.product.rest_api_types.RestApiAuthenticationMethod, Callable[[sgr_specification.v0.product.RestApiInterface, aiohttp.client.ClientSession], Awaitable[bool]]]
async sgr_commhandler.driver.rest.authentication.setup_authentication(rest_api_interface, session)

Performs authentication asynchronously, depending on the configured method.

Parameters:
  • interface (RestApiInterface) – the device interface

  • session (ClientSession) – the REST client session

  • rest_api_interface (sgr_specification.v0.product.RestApiInterface)

Returns:

True if authenticated, False otherwise

Return type:

bool