CBSAuthMixin Class

Mixin to handle sending and refreshing CBS auth tokens.

Inheritance
builtins.object
CBSAuthMixin

Constructor

CBSAuthMixin()

Methods

close_authenticator

Close the CBS auth channel and session.

create_authenticator

Create the AMQP session and the CBS channel with which to negotiate the token.

handle_token

This function is called periodically to check the status of the current token if there is one, and request a new one if needed. If the token request fails, it will be retried according to the retry policy. A token refresh will be attempted if the token will expire soon.

This function will return a tuple of two booleans. The first represents whether the token authentication has not completed within it's given timeout window. The second indicates whether the token negotiation is still in progress.

update_token

Update a token that is about to expire. This is specific to a particular token type, and therefore must be implemented in a child class.

close_authenticator

Close the CBS auth channel and session.

close_authenticator()

create_authenticator

Create the AMQP session and the CBS channel with which to negotiate the token.

create_authenticator(connection, debug=False, **kwargs)

Parameters

Name Description
connection
Required

The underlying AMQP connection on which to create the session.

debug

Whether to emit network trace logging events for the CBS session. Default is False. Logging events are set at INFO level.

Default value: False

Returns

Type Description

handle_token

This function is called periodically to check the status of the current token if there is one, and request a new one if needed. If the token request fails, it will be retried according to the retry policy. A token refresh will be attempted if the token will expire soon.

This function will return a tuple of two booleans. The first represents whether the token authentication has not completed within it's given timeout window. The second indicates whether the token negotiation is still in progress.

handle_token()

Returns

Type Description

Exceptions

Type Description
uamqp.errors.AuthenticationException if the token authentication fails.
uamqp.errors.TokenExpired if the token has expired and cannot berefreshed.

update_token

Update a token that is about to expire. This is specific to a particular token type, and therefore must be implemented in a child class.

update_token()