1
1
import json
2
2
import logging
3
+ from typing import Tuple , List
3
4
4
5
from spaceone .core import cache , config
5
6
from spaceone .core .connector .space_connector import SpaceConnector
@@ -37,7 +38,9 @@ def verify(self, params: dict) -> None:
37
38
if owner_type == "APP" :
38
39
client_id = token_info .get ("jti" )
39
40
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
41
44
42
45
self ._update_meta (token_info )
43
46
@@ -55,7 +58,7 @@ def _get_public_key(self, domain_id: str) -> str:
55
58
@cache .cacheable (
56
59
key = "handler:authentication:{domain_id}:client:{client_id}" , alias = "local"
57
60
)
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 ]] :
59
62
system_token = config .get_global ("TOKEN" )
60
63
61
64
_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:
68
71
token = system_token ,
69
72
)
70
73
71
- return response .get ("permissions" , [])
74
+ return response .get ("permissions" , []), response . get ( "projects" , [])
72
75
73
76
def _authenticate (self , token : str , domain_id : str ) -> dict :
74
77
public_key = self ._get_public_key (domain_id )
0 commit comments