fix: omit null nonce in id token and add config documentation - #9
Merged
Conversation
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.
Description
Three changes:
1. Fix ID Token Serialization
Add
#[serde(skip_serializing_if = "Option::is_none")]on all optionalIdTokenClaimsfields (nonce,at_hash,c_hash,azp,typ,sid,jti,auth_time).Previously,
Nonevalues were serialized asnullin the JWT payload(e.g.
"nonce": null).oauth4webapiperforms a strict-equality checkon the
nonceclaim and rejects the ID token when it sees"nonce": nullinstead of the key being absent. Now the key is omitted entirely when absent,
matching the OIDC Core spec.
2. Sample Config File
Add
config.sample.yamlwith everyIssuerConfigfield documented andset to its default value, so users have a ready-to-copy reference.
3. Documentation
Add a "Configuration" section to the README covering
default_user_id,all config fields with their env vars (
OAUTH_*) and defaults, loadingorder, and a reference to the sample config file.
Update
src/lib.rsdoc comments with a pointer to the README config docs.Changes
src/models.rs- Add#[serde(skip_serializing_if = "Option::is_none")]to all
Optionfields inIdTokenClaimsconfig.sample.yaml- New sample config fileREADME.md- New "Configuration" section with full field tablesrc/lib.rs- Brief config docs referencing READMETests
tests/crypto.rstest_id_token_omits_nonce_key_when_not_provided- raw JSON assertthat
"nonce"key is absent when none was senttest_id_token_includes_nonce_key_when_provided- raw JSON assertthat key is present when nonce is sent
src/main.rstest_id_token_omits_nonce_when_not_sent- full HTTP end-to-end flowwithout nonce, checks ID token payload
tests/config.rstest_config_sample_file- parsesconfig.sample.yamland assertsevery field matches documented defaults