@@ -32,6 +32,7 @@ class Introspection(Endpoint):
32
32
def __init__ (self , upstream_get , ** kwargs ):
33
33
Endpoint .__init__ (self , upstream_get , ** kwargs )
34
34
self .offset = kwargs .get ("offset" , 0 )
35
+ self .enforce_aud_restriction = kwargs .get ("enforce_audience_restriction" , True )
35
36
36
37
def _introspect (self , token , client_id , grant ):
37
38
# Make sure that the token is an access_token or a refresh_token
@@ -114,8 +115,17 @@ def process_request(self, request=None, release: Optional[list] = None, **kwargs
114
115
if not aud :
115
116
aud = grant .resources
116
117
117
- if request ["client_id" ] not in aud :
118
- return {"response_args" : _resp }
118
+ client_id = request ["client_id" ]
119
+ try :
120
+ _cinfo = _context .cdb [client_id ]
121
+ enforce_aud_restriction = _cinfo .get (
122
+ "enforce_audience_restriction" , self .enforce_aud_restriction
123
+ )
124
+ except :
125
+ enforce_aud_restriction = self .enforce_aud_restriction
126
+ if enforce_aud_restriction :
127
+ if request ["client_id" ] not in aud :
128
+ return {"response_args" : _resp }
119
129
120
130
_info = self ._introspect (_token , _session_info ["client_id" ], _session_info ["grant" ])
121
131
if _info is None :
0 commit comments