go-fed / apcore

Golang ActivityPub Server Framework
GNU Affero General Public License v3.0
104 stars 10 forks source link

OAuth first-party proxy #50

Closed cjslep closed 3 years ago

cjslep commented 3 years ago

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 commented 3 years ago

ea8c804eac12566c38ab6bea6a06cd59a6d84a44 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 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:

cjslep commented 3 years ago

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

cjslep commented 3 years ago

c80fd1bf9c6423afbba8c8bb9f087d94f626e947 periodically cleans up expired credentials.