qcs_api_client.client._configuration.secrets#

Module Contents#

Classes#

TokenPayload

TokenPayload represents a response from the OAuth2 POST /token endpoint.

QCSClientConfigurationSecretsCredentials

A set of credentials containing a TokenPayload.

QCSClientConfigurationSecrets

The user's full set of QCS secrets.

class qcs_api_client.client._configuration.secrets.TokenPayload#

Bases: pydantic.BaseModel

TokenPayload represents a response from the OAuth2 POST /token endpoint.

It contains an access_token which may be set as a Bearer token in the Authorization header on HTTP requests to the QCS API.

QCSAuth will use the refresh_token to refresh the access_token if the token expires.

refresh_token :Optional[str]#
access_token :Optional[str]#
scope :Optional[str]#
expires_in :Optional[int]#
id_token :Optional[str]#
token_type :Optional[str]#
get_access_token_claims(key: Union[None, bytes, str] = None)#

Return the claims within the encoded access token.

If a JWK is provided as key, verify the claims as well. If no key is provided, be aware that the returned claims might be forged or invalid.

property access_token_expires_at Optional[datetime.datetime]#

Return the datetime that the token expires (if any).

should_refresh() bool#

Return True if the token is past or nearing expiration and should be refreshed.

class qcs_api_client.client._configuration.secrets.QCSClientConfigurationSecretsCredentials#

Bases: pydantic.BaseModel

A set of credentials containing a TokenPayload.

token_payload :Optional[TokenPayload]#
property access_token Optional[str]#
property refresh_token Optional[str]#
class qcs_api_client.client._configuration.secrets.QCSClientConfigurationSecrets#

Bases: qcs_api_client.client._configuration.file.QCSClientConfigurationFile

The user’s full set of QCS secrets.

This class maps QCSClientConfigurationSecretsCredentials by user specified names. Each set of credentials, in turn, contains a TokenPayload.

credentials :Dict[str, QCSClientConfigurationSecretsCredentials]#
update_token(*, credentials_name: str, token: TokenPayload) None#

Update the value of a token payload in memory and (if appropriate) on disk.