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 2 support #225

Merged
merged 6 commits into from Dec 31, 2019
Merged

OAuth 2 support #225

merged 6 commits into from Dec 31, 2019

Conversation

ngerakines
Copy link
Collaborator

@ngerakines ngerakines commented Dec 19, 2019

This PR introduces OAuth 2.0 support as a client application integrating against a OAuth provider.

Change Log

Added

  • github.com/writeas/writefreely/db package that contains database and storage utility and helper code
  • Database testing utility code in github.com/writeas/writefreely/main_test.go
  • OAuth 2.0 HTTP handlers and wired them into /oauth/write.as and /oauth/callback
  • The users_oauth and oauth_client_state tables with migrations (v4).

Changed

  • The configuration structure to include OAuth application configuration.

  • I have signed the CLA

@ngerakines ngerakines requested review from thebaer and a user December 19, 2019 17:08
@ngerakines ngerakines self-assigned this Dec 19, 2019
@thebaer thebaer added this to the 0.12 milestone Dec 19, 2019
@ngerakines ngerakines marked this pull request as ready for review December 24, 2019 18:59
Copy link
Member

@thebaer thebaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small notes after reading through. I'll be able to actually run / test later today or tomorrow, and give my final review then.

config/config.go Show resolved Hide resolved
database.go Outdated Show resolved Hide resolved
@thebaer
Copy link
Member

thebaer commented Dec 28, 2019

Thanks. So how can I test and verify this? Do you have sample config values if I'm running Write.as locally?

@ngerakines
Copy link
Collaborator Author

Thanks. So how can I test and verify this? Do you have sample config values if I'm running Write.as locally?

I sent my local setup to you privately.

@ngerakines ngerakines mentioned this pull request Dec 30, 2019
1 task
This checks to see if we get a response with a populated `error` field
in exchangeOauthCode(). If so, we return that error message as an error,
to ensure the callback logic doesn't continue with a bad response.

Ref T705
Copy link
Member

@thebaer thebaer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing, everything looks good! I committed a few changes I needed: added some helpful logging and fixed some error-passing during the code exchange process.

Last thing: we should update the database table names to be consistent with the current naming scheme. Then we'll get this merged!

migrations/v4.go Outdated Show resolved Hide resolved
migrations/v4.go Outdated Show resolved Hide resolved
@thebaer
Copy link
Member

thebaer commented Dec 31, 2019

Perfect -- thanks @ngerakines! Merging now.

@thebaer thebaer merged commit f343ceb into develop Dec 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants