-
-
Notifications
You must be signed in to change notification settings - Fork 795
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
Separate resource server implementation #526
Comments
where does the RESOURCE_SERVER_AUTH_TOKEN come from in this case? Is it just some random token you choose to create? |
Essentially, yes. The process I use is as follows:
What I think we should be doing is giving the credentials from (1) in the resource server settings, and django-oauth-toolkit should be doing (2). We wouldn't need to do (3) because the resource server would request a new token using its client credentials when the token expires. |
@mkjpryor-stfc do the two applications share a database in this case? Which of the two applications stores the user credentials? Or do they both store the user details? I am really confused about how to achieve this. |
The authorisation server and the resource server are totally different machines with no shared database. Only the authorisation server has the credentials and issues tokens. The resource server can check if a token is valid and the scopes it has by using the introspection endpoint. See https://github.com/evonove/django-oauth-toolkit/blob/master/docs/resource_server.rst. |
@mkjpryor-stfc: |
Your resource server has its own set of users with the same usernames as those on the authorisation server. django-oauth-toolkit handles the creation and authentication of these users for you based on interactions with the introspection endpoint. If you delete a user and all their resources on the authorisation server, then their tokens will no longer be considered valid by the introspection endpoint, and so their resources on the resource server will become inaccessible. But they won't actually be deleted because, as you say, it is a different DB and there is no foreign key constraint to cascade. You would have to do that manually. |
P.S. In the nicest possible way, this thread wasn't meant to be explaining how this works... You can read the docs, RFCs and code for that. I was asking if it can be done better than it is now. |
How do I create a I've created an issue which I'm not able to understand. Following is the link of the github issue. Kindly provide your expertise. |
where should django store this token? |
There is nothing to store that isn't already stored. The deployment procedure would be:
From then on, when the Resource Server needs to perform token introspection, it can use its client credentials to obtain a token to do so (or use an existing token if not expired). This flow means that we do not need to manually create a token or manually extend the expiration date of that token, both of which feel like hacks to me... |
Yeah, I know what you mean. |
How come the separate resource server implementation uses a pre-generated access token (RESOURCE_SERVER_AUTH_TOKEN) to access the introspect endpoint?
I may be missing something, but rather than requiring a pre-generated access token with a long TTL, isn't this is an ideal use case for the client credentials flow?
The text was updated successfully, but these errors were encountered: