Forward optional nonce on /authorize request#271
Open
partha-uber wants to merge 1 commit into
Open
Conversation
The auth server requires a nonce on /authorize when openid is in the requested scope, so it can echo it back as the nonce claim of the issued ID token for replay protection. The SDK previously had no way for developers to supply one. Add an optional nonce field on AuthContext that AuthProvider forwards to UniversalSsoLink (via the existing optionalQueryParams map), so it ends up as the nonce= query param on /authorize. The SDK does not generate, store, or validate the value — that stays with the caller's backend. Test Plan: unit tests covering nonce present and absent.
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
The Uber auth server requires a
noncequery parameter on/authorizewhen the requested scope includesopenid. It echoes the value back as thenonceclaim of the issued ID token so the caller's backend can verify it and reject replays. Today the Android SDK has no way for developers to supply one — there's only anINVALID_NONCEerror enum on the receiving side.This adds an optional
nonce: String?field onAuthContext. When set,AuthProviderputs it into theoptionalQueryParamsmap it already passes toUniversalSsoLink.execute(), which appends it to the/authorizeURL. No signature change toUriConfig.assembleUri(), no behavior change when the caller doesn't set it.The SDK does not generate, store, or validate the nonce — that responsibility stays with the caller's backend (which already has to maintain a server-wide dedupe set per the partner integration spec).
Files changed
core/.../UriConfig.kt— addNONCE_PARAM = "nonce"constant.authentication/.../request/AuthContext.kt— addnonce: String?field with KDoc.authentication/.../internal/AuthProvider.kt— includenonceingetQueryParams()when present.AuthProviderTestverifies the nonce is forwarded when present and absent when not.Test plan
./gradlew :authentication:test :core:test— green./gradlew :authentication:assemble :core:assemble :rides-android:assemble— green./gradlew spotlessCheck— greenopenidis in scope).Revert plan
Straight
git revert— no migrations, only an additive optional field. Existing callers compile unchanged.