SASTokenAuth Class
CBS authentication using SAS tokens.
- Inheritance
-
SASTokenAuthSASTokenAuth
Constructor
SASTokenAuth(audience, uri, token, expires_in=None, expires_at=None, username=None, password=None, port=None, timeout=10, retry_policy=<uamqp.authentication.cbs_auth.TokenRetryPolicy object>, verify=None, token_type=b'servicebus.windows.net:sastoken', http_proxy=None, transport_type=<TransportType.Amqp: 1>, encoding='UTF-8', **kwargs)
Parameters
- expires_at
- float
The timestamp at which the SAS token will expire formatted as seconds since epoch.
- username
- str
The SAS token username, also referred to as the key name or policy name. This can optionally be encoded into the URI.
- password
- str
The SAS token password, also referred to as the key. This can optionally be encoded into the URI.
- 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"servicebus.windows.net:sastoken".
- 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
| from_shared_access_key |
Attempt to create a CBS token session using a Shared Access Key such as is used to connect to Azure services. time to start the process of token refresh. Default value is 10% of the remaining seconds until the token expires. |
| update_token |
If a username and password are present - attempt to use them to request a fresh SAS token. |
from_shared_access_key
Attempt to create a CBS token session using a Shared Access Key such as is used to connect to Azure services.
time to start the process of token refresh. Default value is 10% of the remaining seconds until the token expires.
from_shared_access_key(uri, key_name, shared_access_key, expiry=None, port=None, timeout=10, retry_policy=<uamqp.authentication.cbs_auth.TokenRetryPolicy object>, verify=None, http_proxy=None, transport_type=<TransportType.Amqp: 1>, encoding='UTF-8', **kwargs)
Parameters
- 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.
- 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'.
update_token
If a username and password are present - attempt to use them to request a fresh SAS token.
update_token()
Feedback
Submit and view feedback for