@@ -45,13 +45,13 @@ def convert_scopes2claims(scopes, allowed_claims=None, scope2claim_map=None):
4545
4646
4747class Scopes :
48- def __init__ (self , server_get , allowed_scopes = None , scopes_mapping = None ):
48+ def __init__ (self , server_get , allowed_scopes = None , scopes_to_claims = None ):
4949 self .server_get = server_get
50- if not scopes_mapping :
51- scopes_mapping = dict (SCOPE2CLAIMS )
52- self .scopes_mapping = scopes_mapping
50+ if not scopes_to_claims :
51+ scopes_to_claims = dict (SCOPE2CLAIMS )
52+ self ._scopes_to_claims = scopes_to_claims
5353 if not allowed_scopes :
54- allowed_scopes = list (scopes_mapping .keys ())
54+ allowed_scopes = list (scopes_to_claims .keys ())
5555 self .allowed_scopes = allowed_scopes
5656
5757 def get_allowed_scopes (self , client_id = None ):
@@ -67,8 +67,8 @@ def get_allowed_scopes(self, client_id=None):
6767 if client is not None :
6868 if "allowed_scopes" in client :
6969 allowed_scopes = client .get ("allowed_scopes" )
70- elif "scopes_mapping " in client :
71- allowed_scopes = list (client .get ("scopes_mapping " ).keys ())
70+ elif "scopes_to_claims " in client :
71+ allowed_scopes = list (client .get ("scopes_to_claims " ).keys ())
7272
7373 return allowed_scopes
7474
@@ -79,21 +79,21 @@ def get_scopes_mapping(self, client_id=None):
7979 :param client_id: The client identifier
8080 :returns: Dict of scopes to claims. Can be empty.
8181 """
82- scopes_mapping = self .scopes_mapping
82+ scopes_to_claims = self ._scopes_to_claims
8383 if client_id :
8484 client = self .server_get ("endpoint_context" ).cdb .get (client_id )
8585 if client is not None :
86- scopes_mapping = client .get ("scopes_mapping " , scopes_mapping )
87- return scopes_mapping
86+ scopes_to_claims = client .get ("scopes_to_claims " , scopes_to_claims )
87+ return scopes_to_claims
8888
8989 def filter_scopes (self , scopes , client_id = None ):
9090 allowed_scopes = self .get_allowed_scopes (client_id )
9191 return [s for s in scopes if s in allowed_scopes ]
9292
93- def scopes_to_claims (self , scopes , scopes_mapping = None , client_id = None ):
94- if not scopes_mapping :
95- scopes_mapping = self .get_scopes_mapping (client_id )
93+ def scopes_to_claims (self , scopes , scopes_to_claims = None , client_id = None ):
94+ if not scopes_to_claims :
95+ scopes_to_claims = self .get_scopes_mapping (client_id )
9696
9797 scopes = self .filter_scopes (scopes , client_id )
9898
99- return convert_scopes2claims (scopes , scope2claim_map = scopes_mapping )
99+ return convert_scopes2claims (scopes , scope2claim_map = scopes_to_claims )
0 commit comments