Skip to content

Commit 4fe4bbe

Browse files
authored
NOJIRA Related to VED-779 Restore destroy pipeline functionality (#848)
1 parent 7ff30b4 commit 4fe4bbe

File tree

2 files changed

+9
-24
lines changed

2 files changed

+9
-24
lines changed

azure/azure-pr-teardown-pipeline.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
5858
- bash: |
5959
export AWS_PROFILE=apim-dev
60-
cd mns_subscription
60+
cd lambdas/mns_subscription
6161
6262
echo "unsubscribing SQS Queue from MNS notifications."
6363
pyenv install -s 3.11.11

lambdas/shared/src/common/authentication.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -48,26 +48,13 @@ def create_jwt(self, now: int):
4848
"exp": now + self.expiry,
4949
"jti": str(uuid.uuid4())
5050
}
51-
logger.info(f"JWT claims: {claims}")
52-
# ✅ Version-compatible JWT encoding
53-
try:
54-
# PyJWT 2.x
55-
return jwt.encode(
56-
claims,
57-
secret_object['private_key'],
58-
algorithm='RS512',
59-
headers={"kid": secret_object['kid']}
60-
)
61-
except TypeError:
62-
# PyJWT 1.x (older versions return bytes)
63-
token = jwt.encode(
64-
claims,
65-
secret_object['private_key'],
66-
algorithm='RS512',
67-
headers={"kid": secret_object['kid']}
68-
)
69-
# Convert bytes to string if needed
70-
return token.decode('utf-8') if isinstance(token, bytes) else token
51+
52+
return jwt.encode(
53+
claims,
54+
secret_object['private_key'],
55+
algorithm='RS512',
56+
headers={"kid": secret_object['kid']}
57+
)
7158

7259
def get_access_token(self):
7360
logger.info("get_access_token")
@@ -77,16 +64,14 @@ def get_access_token(self):
7764
logger.info(f"Cache key: {self.cache_key}")
7865
logger.info("Checking cache for access token")
7966
cached = self.cache.get(self.cache_key)
80-
logger.info(f"Cached token: {cached}")
67+
8168
if cached and cached["expires_at"] > now:
8269
logger.info("Returning cached access token")
8370
return cached["token"]
8471

8572
logger.info("No valid cached token found, creating new token")
8673
_jwt = self.create_jwt(now)
8774

88-
logger.info(f"JWT created: {_jwt}")
89-
9075
headers = {
9176
'Content-Type': 'application/x-www-form-urlencoded'
9277
}

0 commit comments

Comments
 (0)