Skip to content

Commit

Permalink
Merge pull request #110 from stat-kwon/master
Browse files Browse the repository at this point in the history
fix: apply get token type by using JWTUtil
  • Loading branch information
stat-kwon authored Jan 4, 2024
2 parents ed9ff3c + a1bd521 commit 077aba1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/spaceone/monitoring/manager/identity_manager.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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":
Expand Down
4 changes: 3 additions & 1 deletion src/spaceone/monitoring/manager/notification_manager.py
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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}")
Expand Down

0 comments on commit 077aba1

Please sign in to comment.