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

Auth overhaul #79

Merged
merged 46 commits into from
Jun 25, 2023
Merged

Auth overhaul #79

merged 46 commits into from
Jun 25, 2023

Conversation

shanedg
Copy link
Owner

@shanedg shanedg commented Jan 9, 2023

No description provided.

discord/lib/views/login.html Outdated Show resolved Hide resolved
@shanedg shanedg force-pushed the auth-overhaul branch 2 times, most recently from 5976f70 to e904770 Compare February 20, 2023 10:27
Establish explicit paths for intercepting the authorization code,
rendering the login page, and rendering the authenticated application.
Replace authenticated html template with @trshcmpctr/client build.
Replace hard-coded localhost addresses with a required redirect_uri
configuration option.
Add a helper for creating redirect handlers.

Rename getNewTokenWithDependencies to createAuthorizationCodeGrantHandler.
createAuthorizationCodeGrantHandler now:
- no longer renders any html
- only responsible for authenticating from authorization code
- no longer fetches user and guild data
- no longer injects user data or new session flag

Rename getRenderLoginWithData to createLoginRenderHandler.
createLoginRenderHandler no longer checks for code query param because this
is now exclusively handled by getHandleAuthentication.

Rename getReuseSessionTokenWithDependencies
to createAuthenticatedRenderHandler.
createAuthenticatedRenderHandler now:
- renders html from @trshcmpctr/client build
- no longer fetches user and guild data
- no longer injects user data or new session flag
Discord auth ensures we have the user's identity but we require them to
be a member of a particular guild to be authorized to see any data or
take any actions.
Removes previous guild membership check based on separate user and guild
API requests.
Removes now-unused request batching and guild filtering utils.
Removes now-unused 'identity' scope.
Replace cookie-session with express-session backed by filesystem store
Return guild membership handler from a higher order function to allow
for more convenient testing.
Catch possible rejections from fetching the discord api.
Add tests.
Catch possible rejections from posting the discord token endpoint
Avoid test file before hook for only one test
Express does not catch *any* handler errors automatically
@shanedg shanedg force-pushed the auth-overhaul branch 2 times, most recently from b7ee4fe to 4cafd24 Compare June 25, 2023 17:34
@shanedg shanedg marked this pull request as ready for review June 25, 2023 17:46
@shanedg shanedg merged commit f968b4b into main Jun 25, 2023
1 check passed
@shanedg shanedg deleted the auth-overhaul branch June 25, 2023 17:57
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.

None yet

1 participant