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

OAuth first-party proxy #50

Closed
cjslep opened this issue Dec 18, 2020 · 3 comments
Closed

OAuth first-party proxy #50

cjslep opened this issue Dec 18, 2020 · 3 comments
Assignees
Labels
feature request New request for novel functionality
Milestone

Comments

@cjslep
Copy link
Member

cjslep commented Dec 18, 2020

As mentioned in #36, an internal proxy is needed to manage the first party login page of applications using apcore. This means the underlying auth used is uniform for third and first parties, we can just provide a slightly different user experience for the first-party.

@cjslep cjslep added the feature request New request for novel functionality label Dec 18, 2020
@cjslep cjslep added this to the v0.1.0 milestone Dec 18, 2020
@cjslep cjslep self-assigned this Dec 18, 2020
@cjslep
Copy link
Member Author

cjslep commented Dec 19, 2020

ea8c804 has an internal proxy when a user goes through a typical login/logout endpoint flow, so that an OAuth credential is generated in the process. The way it is structured is as follows:

  • The user's browser has a cookie as usual, containing a cookie_id (which, as usual, should be protected from XSS). The cookie_id itself is not PII but it is sensitive.
  • The server session uses the cookie id to look up a payload of data. In this case, a credential_id is associated with the user's cookie_id session.
  • The credential_id has an entry in the new first_party_creds table that associates the credential_id with a user_id and an oauth_token_id.

The expirations for that OAuth token are able to be checked like any other OAuth token. Furthermore, there is a middleware function that checks if a user that is browsing has a cookie_id, and if it has a credential_id, if it needs to be refreshed (close to expiry), and if so, refreshes it, without interfering with the user's experience.

Further work to be done:

  • Verify the new model behaves in the database as expected
  • Create a periodic job that cleans out stale credential entries

@cjslep
Copy link
Member Author

cjslep commented Dec 20, 2020

80cff20 does the first bullet ("Verify the new model behaves in the database as expected")

@cjslep
Copy link
Member Author

cjslep commented Dec 20, 2020

c80fd1b periodically cleans up expired credentials.

@cjslep cjslep closed this as completed Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New request for novel functionality
Projects
None yet
Development

No branches or pull requests

1 participant