Suport Array of String for Audience
See original GitHub issueFrom the JWT specification, the Audience should accept a array of strings. Whould be nice a methot setAudience that accept a array of Strings and put this attribute as array on JWT As a workaround, I’m setting this as a claim attribute:
String[] aud = { "aud1", "aud2" };
Jwts.builder().claim("aud", aud);
...
Generated payload:
{
"iss": "issuer",
"aud": [
"aud1",
"aud2"
],
"iat": 1443461450
}
From https://tools.ietf.org/html/rfc7519#section-4.1.3
4.1.3. "aud" (Audience) Claim
The "aud" (audience) claim identifies the recipients that the JWT is
intended for. Each principal intended to process the JWT MUST
identify itself with a value in the audience claim. If the principal
processing the claim does not identify itself with a value in the
"aud" claim when this claim is present, then the JWT MUST be
rejected. In the general case, the "aud" value is an array of case-
sensitive strings, each containing a StringOrURI value. In the
special case when the JWT has one audience, the "aud" value MAY be a
single case-sensitive string containing a StringOrURI value. The
interpretation of audience values is generally application specific.
Use of this claim is OPTIONAL.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:6 (1 by maintainers)
Top Results From Across the Web
array of strings contains a string value matching this regex
It would be a great help to be able to use regex for condition when working with arrays of strings because of several...
Read more >Working with Collections | Defining and Using Classes
Describes how to use collections, which are arrays or lists of elements, all of the same type. The elements can be literal values...
Read more >Field Data Types - Iterable Support Center
Each field in a user profile or event in Iterable has a value type: string, date, integer, long, double, or boolean. Iterable also...
Read more >Array - Sanity.io
Schema type for arrays of other types. ... This option only works if the array contains strings. If set to grid it will...
Read more >Helpers - Laravel - The PHP Framework For Web Artisans
Using this method's second argument, you may also specify the joining string for the final element of the array: use Illuminate\Support\Arr;.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It would be good if the requireAudience method could also work with arrays.
I’ve made a PR #238 that, if it’s accepted, would add support for string arrays in audience attribute without breaks the current functionality. The idea behind the PR is to handle both a simple String and a String array.