Skip to content
This repository was archived by the owner on Jun 12, 2021. It is now read-only.

Commit 42e180b

Browse files
committed
Have the parse_request method of the introspection endpoint return an
error message if the token parameter is missing. Actually it returns an error message if anything in the introspection request is not correct.
1 parent 547e45b commit 42e180b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/oidcendpoint/oauth2/introspection.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def process_request(self, request=None, **kwargs):
4040
:return:
4141
"""
4242
_introspect_request = self.request_cls(**request)
43+
if "error" in _introspect_request:
44+
return _introspect_request
4345

4446
_jwt = JWT(key_jar=self.endpoint_context.keyjar)
4547

tests/test_31_introspection.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,15 @@ def test_do_response(self):
226226
"jti",
227227
}
228228
assert _payload["active"] == True
229+
230+
def test_do_response_no_token(self):
231+
_context = self.introspection_endpoint.endpoint_context
232+
_ = setup_session(_context, AUTH_REQ, uid="diana")
233+
_req = self.introspection_endpoint.parse_request(
234+
{
235+
"client_id": "client_1",
236+
"client_secret": _context.cdb["client_1"]["client_secret"],
237+
}
238+
)
239+
_resp = self.introspection_endpoint.process_request(_req)
240+
assert "error" in _resp

0 commit comments

Comments
 (0)