feat: add magic link auth provider with code exchange#2649
Draft
mroderick wants to merge 2 commits into
Draft
Conversation
Adds a custom OmniAuth provider that delegates authentication to a separate auth app. The auth callback receives a one-time code which is exchanged server-to-server for a JWT, verified against the auth app's JWKS endpoint. State/nonce protects against CSRF; only RS256/ES256 algorithms are accepted.
e01eabc to
8ed635e
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a custom OmniAuth strategy (
:codebar) that delegates authentication to a separate auth app running on port 3001. The auth app becomes an identity provider — users authenticate via magic link or GitHub OAuth on the auth app, which issues a one-time code exchanged server-to-server for a signed JWT.Key Design Decisions
:githuband:codebarproviders coexist — existing auth controller unchanged.Files
lib/omniauth/strategies/codebar.rb— Custom OmniAuth strategy (request_phase, callback_phase, code exchange, JWT verification)config/initializers/omniauth.rb— Added:codebarprovider alongside existing:githubspec/lib/omniauth/strategies/codebar_spec.rb— 16 tests covering all error paths through callback phaseGemfile/Gemfile.lock— AddedjwtgemTesting
484 examples, 0 failures. All existing auth service tests continue to pass. New strategy tests cover state mismatch, missing code, empty code, exchange failure, JWT verification failure, and full success path.