-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
201 changed files
with
3,227 additions
and
1,645 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# How Does Github Login Work? | ||
|
||
The auth related stuff is in `fastn_core::auth` module. | ||
|
||
## Login | ||
|
||
To login we send user to `/-/auth/login?provider=github&next=<optional redirect url>`. | ||
|
||
The `next` can be used to send the user to arbitrary URL after successful signing. | ||
|
||
We use `oauth2` crate for authentication with github. | ||
|
||
## Callback URL | ||
|
||
The callback URL is | ||
|
||
## CSRF Token | ||
|
||
Are we CSRF safe? We are generating a CSRF token using `oauth2::CsrfToken::new_random` in | ||
`fastn_core::auth::github::login()`, but we are not checking it in `fastn_core::auth::github::callback()`. I think | ||
we aught to, else we may be susceptible to CSRF. Not sure how someone can use CSRF in this context, but given | ||
the library supports should too. | ||
|
||
How would we verify? Easiest thing would be to store it in a cookie. This is what Django does, stores CSRF token in | ||
cookie, and verifies that tokens match on POST request etc. | ||
|
Oops, something went wrong.