JWT Bearer Token utilities

class rescalehtc.bearer_token.BearerToken(header: dict, payload: dict, encoded_token: str)

BearerToken objects hold information about a specific Rescale HTC Bearer token, which is a JSON Web Token (JWT).

Access member variables or helper functions here to use the claims in the JWT.

header: dict

Header part of the JWT.

payload: dict

Payload part of the JWT, containing useful info like user email, expiry time, custom claims and more.

get_user_claims() dict

Get any claims in the JWT that were user defined at the time of job submission.

In the pure JWT these claims are prefixed by userDefined_ by Rescale. This function removes the prefix and returns only claims as given by the user at job submission time.

rescalehtc.bearer_token.token_from_str(data: str) BearerToken

Create a BearerToken object from a JWT encoded string of the form “xxxx.yyyy.zzzzz”.

End users should normally not use this function, instead get the BearerToken object by calling get_bearer_token() on the HtcSession object.