Fixed introspection sub claim. Fix #64

This commit is contained in:
Éloi Rivard 2021-10-03 20:26:47 +02:00
parent a00ba086ad
commit 2b307e275a
2 changed files with 4 additions and 3 deletions

View file

@ -243,13 +243,14 @@ class IntrospectionEndpoint(_IntrospectionEndpoint):
def introspect_token(self, token): def introspect_token(self, token):
client_id = Client.get(token.oauthClient).oauthClientID client_id = Client.get(token.oauthClient).oauthClientID
user = User.get(dn=token.oauthSubject)
return { return {
"active": True, "active": True,
"client_id": client_id, "client_id": client_id,
"token_type": token.oauthTokenType, "token_type": token.oauthTokenType,
"username": User.get(dn=token.oauthSubject).name, "username": user.name,
"scope": token.get_scope(), "scope": token.get_scope(),
"sub": token.oauthSubject, "sub": user.uid[0],
"aud": client_id, "aud": client_id,
"iss": authorization.metadata["issuer"], "iss": authorization.metadata["issuer"],
"exp": token.get_expires_at(), "exp": token.get_expires_at(),

View file

@ -14,7 +14,7 @@ def test_token_introspection(testclient, user, client, token):
"token_type": token.oauthTokenType, "token_type": token.oauthTokenType,
"username": user.name, "username": user.name,
"scope": token.get_scope(), "scope": token.get_scope(),
"sub": token.oauthSubject, "sub": user.uid[0],
"aud": client.oauthClientID, "aud": client.oauthClientID,
"iss": "https://mydomain.tld", "iss": "https://mydomain.tld",
"exp": token.get_expires_at(), "exp": token.get_expires_at(),