11import json
22import logging
3+ from typing import Tuple , List
34
45from spaceone .core import cache , config
56from spaceone .core .connector .space_connector import SpaceConnector
@@ -37,7 +38,9 @@ def verify(self, params: dict) -> None:
3738 if owner_type == "APP" :
3839 client_id = token_info .get ("jti" )
3940 domain_id = token_info .get ("did" )
40- token_info ["permissions" ] = self ._check_app (client_id , domain_id )
41+ permissions , projects = self ._check_app (client_id , domain_id )
42+ token_info ["permissions" ] = permissions
43+ token_info ["projects" ] = projects
4144
4245 self ._update_meta (token_info )
4346
@@ -55,7 +58,7 @@ def _get_public_key(self, domain_id: str) -> str:
5558 @cache .cacheable (
5659 key = "handler:authentication:{domain_id}:client:{client_id}" , alias = "local"
5760 )
58- def _check_app (self , client_id , domain_id ) -> list :
61+ def _check_app (self , client_id : str , domain_id : str ) -> Tuple [ List [ str ], List [ str ]] :
5962 system_token = config .get_global ("TOKEN" )
6063
6164 _LOGGER .debug (f"[_check_app] check app from identity service: { client_id } " )
@@ -68,7 +71,7 @@ def _check_app(self, client_id, domain_id) -> list:
6871 token = system_token ,
6972 )
7073
71- return response .get ("permissions" , [])
74+ return response .get ("permissions" , []), response . get ( "projects" , [])
7275
7376 def _authenticate (self , token : str , domain_id : str ) -> dict :
7477 public_key = self ._get_public_key (domain_id )
0 commit comments