@@ -32,6 +32,7 @@ class Introspection(Endpoint):
3232 def __init__ (self , upstream_get , ** kwargs ):
3333 Endpoint .__init__ (self , upstream_get , ** kwargs )
3434 self .offset = kwargs .get ("offset" , 0 )
35+ self .enforce_aud_restriction = kwargs .get ("enforce_audience_restriction" , True )
3536
3637 def _introspect (self , token , client_id , grant ):
3738 # 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
114115 if not aud :
115116 aud = grant .resources
116117
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 }
119129
120130 _info = self ._introspect (_token , _session_info ["client_id" ], _session_info ["grant" ])
121131 if _info is None :
0 commit comments