Skip to content

Commit 93c0815

Browse files
authoredDec 23, 2024··
Merge pull request #115 from whdalsrnt/master
refactor: change jwt utils
2 parents d7883cc + 6a7a67a commit 93c0815

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed
 

‎src/cloudforet/console_api_v2/handler/authentication_handler.py

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
import logging
2-
3-
import jwt
42
from typing import Union
53

64
from spaceone.core import cache
7-
from spaceone.core.error import ERROR_PERMISSION_DENIED
85
from spaceone.core.handler.authentication_handler import SpaceONEAuthenticationHandler
96
from spaceone.core.transaction import get_transaction
7+
from spaceone.core.auth.jwt import JWTUtil
108

119
_LOOGER = logging.getLogger(__name__)
1210

@@ -27,12 +25,6 @@ def _get_token_from_transaction() -> Union[str, None]:
2725
@cache.cacheable(key="console-api-v2:authentication:{token}", expire=300)
2826
def _extract_token_info(token: str):
2927
try:
30-
decoded_payload = jwt.decode(
31-
token,
32-
options={"verify_signature": False},
33-
)
34-
token_info = decoded_payload
35-
return token_info
36-
28+
return JWTUtil.unverified_decode(token)
3729
except Exception as e:
3830
_LOOGER.error(f"Failed to decode token: {e}, {token}", exc_info=True)

0 commit comments

Comments
 (0)
Please sign in to comment.