Add typed OAuth with session support#5567
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Could you pull the latest main? Failing tests seem to be fixed in the main branch. |
# Conflicts: # ktor-server/ktor-server-plugins/ktor-server-auth/api/ktor-server-auth.klib.api
686588c to
8a267ac
Compare
Subsystem
Server Auth
Motivation
https://github.com/ktorio/ktor-klip/blob/zibet27/auth-3.5/proposals/0006-auth-3.5.md
Why
oauthWithSessionThe existing OAuth provider is useful for completing the OAuth callback and obtaining an
OAuthAccessTokenResponse, but it is easy to read it as a provider that can protect application routes directly.That is misleading for typical web login flows: OAuth authenticates only the callback request. It does not persist the login state, create an application principal, or protect later requests. Applications still need to map the token response to their own session/principal and then use session authentication for protected routes.
oauthWithSessionmakes this pattern explicit:This keeps the OAuth provider focused on OAuth, while giving users a typed, end-to-end login flow that matches how OAuth is commonly used in server-side applications.
This is still a question if we want to just provide typed DSL for
oauthoroauthWithSession, as shown in this PR