JWTTokenAsync Class
CBS authentication using JWT tokens.
- Inheritance
-
JWTTokenAsyncJWTTokenAsync
Constructor
JWTTokenAsync(audience, uri, get_token, expires_in=datetime.timedelta(seconds=3600), expires_at=None, port=None, timeout=10, retry_policy=<uamqp.authentication.cbs_auth.TokenRetryPolicy object>, verify=None, token_type=b'jwt', http_proxy=None, transport_type=<TransportType.Amqp: 1>, encoding='UTF-8', **kwargs)
Parameters
- get_token
- <xref:<xref:coroutine function>>
The callback function used for getting and refreshing tokens. It should return a valid jwt token each time it is called.
- expires_in
- timedelta
The total remaining seconds until the token expires - default for JWT token generated by AAD is 3600s (1 hour).
- expires_at
- float
The timestamp at which the JWT token will expire formatted as seconds since epoch.
- timeout
- float
The timeout in seconds in which to negotiate the token. The default value is 10 seconds.
- retry_policy
- TokenRetryPolicy
The retry policy for the PUT token request. The default retry policy has 3 retries.
- token_type
- bytes
The type field of the token request. Default value is b"jwt".
- http_proxy
- dict
HTTP proxy configuration. This should be a dictionary with the following keys present: 'proxy_hostname' and 'proxy_port'. Additional optional keys are 'username' and 'password'.
- transport_type
- <xref:uamqp.TransportType>
The transport protocol type - default is ~uamqp.TransportType.Amqp. ~uamqp.TransportType.AmqpOverWebsocket is applied when http_proxy is set or the transport type is explicitly requested.
- encoding
- str
The encoding to use if hostname is provided as a str. Default is 'UTF-8'.
- refresh_window
- int
The time in seconds before the token expiration time to start the process of token refresh. Default value is 10% of the remaining seconds until the token expires.
Methods
| create_authenticator_async |
Create the async AMQP session and the CBS channel with which to negotiate the token. |
| 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. |
create_authenticator_async
Create the async AMQP session and the CBS channel with which to negotiate the token.
async create_authenticator_async(connection, debug=False, loop=None, **kwargs)
Parameters
- debug
- bool
Whether to emit network trace logging events for the CBS session. Default is False. Logging events are set at INFO level.
- loop
Return type
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.
async update_token()
Feedback
Submit and view feedback for