37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
import base64
|
|
import json
|
|
|
|
from jose import jwt
|
|
|
|
with open('../../doc/files/dls_instance_token_03-26-2025-21-06-23.tok', 'rb') as f:
|
|
DLS_INSTANCE_TOKEN = f.read().decode('utf-8')
|
|
|
|
def test_token():
|
|
payload = json.loads(DLS_INSTANCE_TOKEN)
|
|
|
|
identity_token = payload.get('identityToken', None)
|
|
assert identity_token is not None
|
|
|
|
|
|
def test_jwt():
|
|
payload = json.loads(DLS_INSTANCE_TOKEN)
|
|
identity_token = payload.get('identityToken', None)
|
|
|
|
payload = jwt.get_unverified_claims(identity_token)
|
|
service_instance_identity = payload.get('service_instance_identity', None)
|
|
assert service_instance_identity is not None
|
|
|
|
|
|
def test_b64():
|
|
payload = json.loads(DLS_INSTANCE_TOKEN)
|
|
identity_token = payload.get('identityToken', None)
|
|
payload = jwt.get_unverified_claims(identity_token)
|
|
service_instance_identity = payload.get('service_instance_identity', '')
|
|
|
|
service_instance_identity = base64.b64decode(service_instance_identity.encode('utf-8'))
|
|
assert 1522 == len(service_instance_identity)
|
|
|
|
# todo: whats inside here?
|
|
# todo: find code in official DLS and add logging statements
|
|
assert service_instance_identity == ''
|