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

Add support for multi-value aud claims #86

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

glimberg
Copy link

Introduces a StringOrVec struct and custom serializer/deserialzer for
the aud claim.

Fixes Issue #83

Introduces a StringOrVec struct and custom serializer/deserialzer for
the aud claim.

Fixes Issue mikkyang#83
@glimberg
Copy link
Author

glimberg commented Jun 24, 2022

@mikkyang If you can look at this ASAP, it'd be much appreciated. Need to get a new release out with this change incorporated. Have a deadline of Wednesday, June 22 to get a release going.

@gbrlsnchs
Copy link

This PR covers deserializing the aud claim correctly, but since one and multi are private fields, how is this supposed to let the end user set a value for them to serialize it?

How about an Audience enum instead of a struct? Then you could have Audience::String and Audience::Array. This is a little more idiomatic IMO.

@@ -51,6 +53,76 @@ pub struct RegisteredClaims {
pub json_web_token_id: Option<String>,
}

/// Struct to handle the `aud` field because the JWT spec says that
/// it can be either a string or an array of strings.
/// [Audience Claim Specificatgion](https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).

Choose a reason for hiding this comment

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

Suggested change
/// [Audience Claim Specificatgion](https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).
/// [Audience Claim Specification](https://datatracker.ietf.org/doc/html/rfc7519#section-4.1.3).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants