Skip to content
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

WIP: Add authentication class for DRF #297

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

iyawnis
Copy link

@iyawnis iyawnis commented Oct 23, 2018

This is currently work in progress. I am looking to introduce two new classes, to be used as authentication classes for DRF. The aim of this is to allow a backend service which communicates with a frontend, to verify that the OIDC tokens it receives from the frontend are valid for this service.

As the service I have been using this code with has no concept of user, I am not sure what is the best way of incorporating this concept. Currently, if a request is authenticated, the token payload (whether ID token or the introspection result for access token) is added on request.user.token.

I am looking on feedback on whether this is moving to a reasonable direction. Also please keep in mind I am very short on time, thus this is currently moving very slowly.

Copy link
Owner

@juanifioren juanifioren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Documentation needed

return None

@property
def OIDC_INTERSPECT_USERNAME(self):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo "interspect"

Copy link
Owner

@juanifioren juanifioren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why making an http request in introspect_token method? maybe using existing utils to validate it, or hit directly DB. 🤔

@iyawnis
Copy link
Author

iyawnis commented Oct 24, 2018

The aim of this code is to allow someone who is building a DRF API, to validate OIDC tokens that the frontend is passing to it. As such, it would not have any DB that can verify a token is valid, it would need to communicate with the OIDC server the frontend receives its tokens from.
This is why I open the PR before its ready, to find out if this functionality is something within the scope of this package.

Flow goes like this:

Frontend authenticates with OIDC, receives an ID / access token.
Frontend makes API calls to backend (DRF API) and passes token received from OIDC
Backend verifies the OIDC token is valid for this service, and proceeds with serving the request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants