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

Commit c334dcb

Browse files
authored
Merge pull request #32 from anange/master
Fix token introspection endpoint responses
2 parents 42e180b + c14b3e7 commit c334dcb

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/oidcendpoint/oauth2/introspection.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ def process_request(self, request=None, **kwargs):
4343
if "error" in _introspect_request:
4444
return _introspect_request
4545

46+
_resp = self.response_cls(active=False)
47+
4648
_jwt = JWT(key_jar=self.endpoint_context.keyjar)
4749

4850
try:
4951
_jwt_info = _jwt.unpack(_introspect_request["token"])
5052
except Exception:
51-
return {"response": {"active": False}}
53+
return {"response_args": _resp}
5254

5355
# expired ?
5456
if "exp" in _jwt_info:
5557
now = utc_time_sans_frac()
5658
if _jwt_info["exp"] < now:
57-
return {"response": {"active": False}}
59+
return {"response_args": _resp}
5860

5961
if "release" in self.kwargs:
6062
if "username" in self.kwargs["release"]:
@@ -63,9 +65,9 @@ def process_request(self, request=None, **kwargs):
6365
sub=_jwt_info["sub"]
6466
)
6567
except KeyError:
66-
return {"response": {"active": False}}
68+
return {"response_args": _resp}
6769

68-
_resp = self.response_cls(**_jwt_info)
70+
_resp.update(_jwt_info)
6971
_resp.weed()
7072
_resp["active"] = True
7173

0 commit comments

Comments
 (0)