Skip to content

Add support for multi-value aud claims#86

Open
glimberg wants to merge 1 commit into
mikkyang:masterfrom
glimberg:master
Open

Add support for multi-value aud claims#86
glimberg wants to merge 1 commit into
mikkyang:masterfrom
glimberg:master

Conversation

@glimberg
Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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.

Comment thread src/claims.rs

/// 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).
Copy link
Copy Markdown

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.

2 participants