From a1bd52180d9dad50b7a322c7c6232361d7c3618d Mon Sep 17 00:00:00 2001 From: seolmin Date: Thu, 4 Jan 2024 23:24:38 +0900 Subject: [PATCH] fix: apply get token type by using JWTUtil --- src/spaceone/monitoring/manager/identity_manager.py | 4 +++- src/spaceone/monitoring/manager/notification_manager.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/spaceone/monitoring/manager/identity_manager.py b/src/spaceone/monitoring/manager/identity_manager.py index 1f1da6d..ff2817b 100644 --- a/src/spaceone/monitoring/manager/identity_manager.py +++ b/src/spaceone/monitoring/manager/identity_manager.py @@ -1,5 +1,6 @@ import logging +from spaceone.core.auth.jwt.jwt_util import JWTUtil from spaceone.core.connector.space_connector import SpaceConnector from spaceone.core.manager import BaseManager @@ -9,10 +10,11 @@ class IdentityManager(BaseManager): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + token = self.transaction.get_meta("token") + self.token_type = self.token_type = JWTUtil.get_value_from_token(token, "typ") self.identity_connector: SpaceConnector = self.locator.get_connector( "SpaceConnector", service="identity" ) - self.token_type = self.transaction.get_meta("authorization.token_type") def get_domain(self, domain_id: str) -> dict: if self.token_type == "SYSTEM_TOKEN": diff --git a/src/spaceone/monitoring/manager/notification_manager.py b/src/spaceone/monitoring/manager/notification_manager.py index 59d24e1..2fadf93 100644 --- a/src/spaceone/monitoring/manager/notification_manager.py +++ b/src/spaceone/monitoring/manager/notification_manager.py @@ -1,5 +1,6 @@ import logging +from spaceone.core.auth.jwt.jwt_util import JWTUtil from spaceone.core.connector.space_connector import SpaceConnector from spaceone.core.manager import BaseManager @@ -9,10 +10,11 @@ class NotificationManager(BaseManager): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + token = self.transaction.get_meta("token") + self.token_type = JWTUtil.get_value_from_token(token, "typ") self.notification_connector: SpaceConnector = self.locator.get_connector( "SpaceConnector", service="notification" ) - self.token_type = self.transaction.get_meta("authorization.token_type") def create_notification(self, message: dict, domain_id: str) -> dict: _LOGGER.debug(f"Notify message: {message}")