@@ -41,7 +41,7 @@ def __init__(self, endpoint, config=None):
4141 "urn:ietf:params:oauth:token-type:refresh_token" ,
4242 ],
4343 "default_requested_token_type" : "urn:ietf:params:oauth:token-type:access_token" ,
44- "policy" : {"" : {"callable " : validate_token_exchange_policy }},
44+ "policy" : {"" : {"function " : validate_token_exchange_policy }},
4545 }
4646 else :
4747 self .config = config
@@ -154,21 +154,21 @@ def _enforce_policy(self, request, token, config):
154154 subject_token_type = ""
155155
156156 policy = config ["policy" ][subject_token_type ]
157- callable = policy ["callable " ]
157+ function = policy ["function " ]
158158 kwargs = policy .get ("kwargs" , {})
159159
160- if isinstance (callable , str ):
160+ if isinstance (function , str ):
161161 try :
162- fn = importer (callable )
162+ fn = importer (function )
163163 except Exception :
164- raise ImproperlyConfigured (f"Error importing { callable } policy callable " )
164+ raise ImproperlyConfigured (f"Error importing { function } policy function " )
165165 else :
166- fn = callable
166+ fn = function
167167
168168 try :
169169 return fn (request , context = _context , subject_token = token , ** kwargs )
170170 except Exception as e :
171- logger .error (f"Error while executing the { fn } policy callable : { e } " )
171+ logger .error (f"Error while executing the { fn } policy function : { e } " )
172172 return self .error_cls (error = "server_error" , error_description = "Internal server error" )
173173
174174 def token_exchange_response (self , token , issued_token_type ):
@@ -285,9 +285,9 @@ def _validate_configuration(self, config):
285285 raise ImproperlyConfigured (
286286 "Default Token Exchange policy configuration is not defined"
287287 )
288- if "callable " not in config ["policy" ]["" ]:
288+ if "function " not in config ["policy" ]["" ]:
289289 raise ImproperlyConfigured (
290- "Missing 'callable ' from default Token Exchange policy configuration"
290+ "Missing 'function ' from default Token Exchange policy configuration"
291291 )
292292
293293 _default_requested_token_type = config .get ("default_requested_token_type" ,
0 commit comments