- Notifications
You must be signed in to change notification settings - Fork 825
HTTP Basic Auth support for introspection (Fix issue #709)#725
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Abhishek8394 commented Jul 29, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
- Add a new mixin that allows authenticating with HTTP basic auth, credentials in body or access tokens - Introduce and abstraction in views.generic to initialize the OauthLibMixin - Change parent class of IntrospectTokenView from 'ScopedProtectedResourceView' to 'ClientProtectedScopedResourceView'
coveralls commented Jul 29, 2019 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Pull Request Test Coverage Report for Build 1344
💛 - Coveralls |
Uh oh!
There was an error while loading. Please reload this page.
Abhishek8394 commented Sep 11, 2019
I can work on merging master in the branch if no one is already working on it |
auvipy commented Sep 12, 2019
could you check the latest failures? |
- test failed because they sent url query params in a post request. That is no longer allowed for security purposes. - Fix: send query params as POST body instead of query params
Abhishek8394 commented Sep 13, 2019
Fixed the tests, issue was sending query params in a POST request. That is not allowed. |
Abhishek8394 commented Sep 13, 2019
Also maybe update the docs to tell people that sending query params in any request except GET is a bad request. |
Uh oh!
There was an error while loading. Please reload this page.
Abhishek8394 commented Oct 18, 2019 via email
Fixed this. Can you merge this now? … ***@***.**** commented on this pull request. ------------------------------ In oauth2_provider/views/mixins.py <#725 (comment)> : > + if request.method.upper() == "OPTIONS": + return super().dispatch(request, *args, **kwargs) + # Validate either with HTTP basic or client creds in request body. + # TODO: Restrict to POST. + valid = self.authenticate_client(request) + if not valid: + # Alternatively allow access tokens + # check if the request is valid and the protected resource may be accessed + valid, r = self.verify_request(request) + if valid: + request.resource_owner = r.user + return super().dispatch(request, *args, **kwargs) + else: + return HttpResponseForbidden() + else: + return super().dispatch(request, *args, **kwargs) no newline |
IvanAnishchuk left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the way tests were fixed. It might also be better to make a separate PR for test suite fixes. Accidentally, I prepared one already: #750
Uh oh!
There was an error while loading. Please reload this page.
Abhishek8394 commented Nov 13, 2019
I got the test fixes from master. Is there anything more required to get this PR merged? |
vijithv commented Dec 30, 2019
Hi, any updates on merging this PR? |
vijithv commented Feb 11, 2020
Hey can we merge this? Tested the PR and it works fine. Just don't want to maintain a fork |
what was asked for was done via #750
n2ygk left a comment • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Abhishek8394 sorry for the moving target but we have a new PR template that asks you to do a few things. Can you review this and check off as appropriate and push up a commit to do that. Specifically, I believe this is good new functionality so it would be great if you could make sure to update the CHANGELOG and documentation. Also credit where credit is due: please add your name to AUTHORS.
Also, it appears the flake8 test (that somebody had incorrectly commented out of tox.ini and is now restored) is now failing, so you'll need to do some minor fixes.
Checklist
- PR only contains one change (considered splitting up PR)
- unit-test added
- documentation updated
CHANGELOG.mdupdated (only for user relevant changes)- author name in
AUTHORS
Abhishek8394 commented Mar 19, 2020
I'll get a fix out in a day or two. In the meanwhile do verify the checklist at the top of the page. |
n2ygk left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Abhishek8394 After pushing you to improve documentation, I'm embarrassed to admit that when I added RESOURCE_SERVER_INTROSPECTION_CREDENTIALS to settings, I failed to document it properly in #557! a093565 fixes that.
But have you documented somewhere how to configure use of HTTP Basic Auth for the introspect endpoint? Can you please add that?
Abhishek8394 commented Mar 23, 2020 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There is not setting or configuration required, it just works and is backwards compatible so existing users won't fail. Detail explanation below: So previously introspection only used to work with access tokens. Now it checks for client authentication first, if that fails then it falls back to checking the access token. Client authentication works as follows:
I think it should be made clear that client_id and client_secret are credentials for each app, not something server-wide. So a user uses the client_id and secret corresponding to the app which is requesting the introspection. |
Abhishek8394 commented Mar 23, 2020
Also documentation at #setup-the-resource-server seems to document about using HTTP basic Auth for introspection. Let me know if I'm missing something on this. |
Fixes#709
Checklist