def main(): """Print out the JWT assertion.""" signing_algorithm_str = "RS256" # RSA headers_str = jwk.base64url_encode( ordered_json_str({ "alg": signing_algorithm_str, "kid": CONTENTS_DICT["private_key_id"], "typ": "JWT", })) payload_str_for_defaults = payload_str(SCOPE_STR) print("Assertion for default scope and no subject:") print( jws._sign_header_and_claims( # pylint: disable=protected-access headers_str, payload_str_for_defaults, signing_algorithm_str, CONTENTS_DICT["private_key"], )) print() payload_str_for_nondefaults = payload_str(ALT_SCOPE_STR, "*****@*****.**") print("Assertion for non-default scope and using a subject:") print( jws._sign_header_and_claims( # pylint: disable=protected-access headers_str, payload_str_for_nondefaults, signing_algorithm_str, CONTENTS_DICT["private_key"], ))
def main(): """Print out the JWT assertion.""" signing_algorithm_str = 'RS256' # RSA headers_str = jwk.base64url_encode( ordered_json_str({ 'alg': signing_algorithm_str, 'kid': CONTENTS_DICT['private_key_id'], 'typ': 'JWT', }) ) payload_str = jwk.base64url_encode( ordered_json_str({ 'aud': CONTENTS_DICT['token_uri'], 'exp': TIMESTAMP + 3600, 'iat': TIMESTAMP, 'iss': CONTENTS_DICT['client_email'], 'scope': SCOPE_STR, }) ) print(jws._sign_header_and_claims( # pylint: disable=protected-access headers_str, payload_str, signing_algorithm_str, CONTENTS_DICT['private_key'] ))