-
Notifications
You must be signed in to change notification settings - Fork 809
Description
Expanding upon the issue #529
It seems that introspection endpoint is not allowing client authentication via HTTP Basic auth. As mentioned in the comments in the code at introspect.py#L13
The RFC allows for HTTP basic auth: https://tools.ietf.org/html/rfc7662#section-2.1
It seems that the authentication is bound to access tokens. This is a problem because the only straight forward way to get access tokens is using client_credentials
grant type. But currently apps are allowed only one grant type.
Reproducing issue
- Create an
confidential
application with grant typeauthorization_code
- Get an access token for some user with respect to the newly created app.
- send introspection request
import requests
import base64
CLIENT_ID='aa'
CLIENT_SECRET='aa'
def introspect(access_token):
payload = {
'token': access_token
}
auth = base64.b64encode((CLIENT_ID + ':' + SECRET).encode())
resp = requests.post('http://localhost:8000/o/introspect/', payload,
headers={
'Authorization': 'Basic ' + auth.decode('latin-1')
})
return resp
print(introspect('tokenhere').text)
There is a workaround proposed for going into django admin and creating an access token for the app but that wouldn't scale.
An alternative would be to use the setting for resource auth token and exclusively allow it only for introspection routes. That might work too, but it would have you leak your introspection token across several resource services.
I would like to work on this if this qualifies as a bug/issue.