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

Improvement/audience can accept list of string #7

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Marco-Parente
Copy link

@Marco-Parente Marco-Parente commented Nov 27, 2019

Because some oAuth2 and OIDC services can also return a list of audiences, not just a String.
Example: https://github.com/ory/hydra

@codecov-io
Copy link

codecov-io commented Nov 27, 2019

Codecov Report

Merging #7 into master will increase coverage by 0.89%.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master     #7      +/-   ##
========================================
+ Coverage    99.1%   100%   +0.89%     
========================================
  Files           1      1              
  Lines         112    113       +1     
========================================
+ Hits          111    113       +2     
+ Misses          1      0       -1
Impacted Files Coverage Δ
lib/corsac_jwt.dart 100% <100%> (+0.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d073e41...592c600. Read the comment docs.

@pulyaevskiy
Copy link
Contributor

Would you be willing to rebase this PR from latest master so that conflicts are resolved?

@@ -133,7 +133,7 @@ class JWT {
String get issuer => _claims['iss'];

/// The audience of this token (value of standard `aud` claim).
String get audience => _claims['aud'];
List<String> get audience => _claims['aud'].cast<String>();
Copy link
Contributor

Choose a reason for hiding this comment

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

According to spec audience can either be a list or a single string value.

It seems that we should preserve this, which means having audience type as Object + updating dartdoc for the property to describe possible return values.

WDYT?

_claims['aud'] = [audience];
} else if (audience is List<String>) {
_claims['aud'] = audience;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly here, if someone wants to set aud as a single string we shouldn't force it to be an array.

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.

3 participants