Title: Add one-of functionality to verification of list claims · Issue #8 · auth0/.github · GitHub
Open Graph Title: Add one-of functionality to verification of list claims · Issue #8 · auth0/.github
X Title: Add one-of functionality to verification of list claims · Issue #8 · auth0/.github
Description: Add one-of functionality to verification of list claims Currently the verification of a claim implemented as a list using withArrayClaim() verifies the claim object using a containsAll()-function. Meaning the token must include all of th...
Open Graph Description: Add one-of functionality to verification of list claims Currently the verification of a claim implemented as a list using withArrayClaim() verifies the claim object using a containsAll()-function. ...
X Description: Add one-of functionality to verification of list claims Currently the verification of a claim implemented as a list using withArrayClaim() verifies the claim object using a containsAll()-function. ...
Opengraph URL: https://github.com/auth0/.github/issues/8
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add one-of functionality to verification of list claims","articleBody":"### Add one-of functionality to verification of list claims\r\n\r\nCurrently the verification of a claim implemented as a list using `withArrayClaim()` verifies the claim object using a `containsAll()`-function. Meaning the token must include _all_ of the elements present in the list input to `withArrayClaim()`.\r\n\r\n##### Problem:\r\nA \"one-of\" check when verifying a list claim is valid. (See for example: https://github.com/auth0/java-jwt/pull/472 and the verification of Issuer. They both use the \"one-of\" verification. ) However it is now limited to only the hardcoded issuer and audience. \r\n\r\n##### Use-case:\r\nMy company uses company-roles as a a claim in the token. (\"roles: [\"admin\", \"team-member\"]). The roles I would like to verify a token with could be mutually exclusive, meaning a user only has one of them. For example: \"grant access if user has _either_ \"admin\" or \"consultant\" role. \r\n\r\n\r\n### Solution: Add \"anyOf\" methods in addition to the `withArrayClaim()`-methods.\r\n\r\nExtend the interface to also include `withAnyOfArrayClaim()` similar to the `withAnyOfAudience()` that will verify if the claim in the token contains _any_ of the elements in the given list. \r\n\r\n## Current workaround:\r\n\r\nCurrently we remove the `withArrayClaim()` from the JWTVerifier usage and rather validate the claim manually from the DecodedJWT. This has created some structural issues in the code and feels unsafe going outside the library for such an important validation step. \r\n\r\n### Additional context\r\n\r\nThis PR: https://github.com/auth0/java-jwt/pull/472 essentially makes the changes, but _only_ for audience. However audience is not the only valid \"one-of\" claim. \r\n\r\nI realise `withArrayClaim()` is to be deprecated in the next version: https://github.com/auth0/java-jwt/pull/403\r\nThis functionality will not easily be implemented with the map-based objects, as you'd have to specify each map-level as either a \"one-of\" or a \"exact-match\". \r\n\r\n\r\nI've seen multiple attempts at \"custom\" or \"map base\" validation functionality being denied. In my eyes this is not added functionality so much as it should have been available from the get-go when withArrayClaim was added.\r\n","author":{"url":"https://github.com/jorundoa","@type":"Person","name":"jorundoa"},"datePublished":"2021-02-10T08:01:05Z","url":"https://github.com/auth0/.github/issues/8"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:7c0176d3-d47f-aa7d-a2ac-f54dbcd36f09 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DB52:19EC1D:56E4AA:720749:6AFE6B24 |
| html-safe-nonce | 1e1f42bb970b59ad255810c1b995f72dc39aa5004dbee19dc0a17e52d4514f3c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEQjUyOjE5RUMxRDo1NkU0QUE6NzIwNzQ5OjZBRkU2QjI0IiwidmlzaXRvcl9pZCI6IjEzNDgxNjU4MTkxMjAzODA3MDgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | de86eb8c028fc1437e44f5c13d3d47a92a572b6b7f8b78211ba6530dcbb7c01a |
| hovercard-subject-tag | issue:805275112 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/auth0/.github/8/issue_layout |
| twitter:image | https://opengraph.githubassets.com/114d6863dadd1045a8b05143e43f7df36374b6a08d778c12a25f6733d8e55553/auth0/.github/issues/8 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/114d6863dadd1045a8b05143e43f7df36374b6a08d778c12a25f6733d8e55553/auth0/.github/issues/8 |
| og:image:alt | Add one-of functionality to verification of list claims Currently the verification of a claim implemented as a list using withArrayClaim() verifies the claim object using a containsAll()-function. ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jorundoa |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/auth0/.github git https://github.com/auth0/.github.git |
| octolytics-dimension-user_id | 2824157 |
| octolytics-dimension-user_login | auth0 |
| octolytics-dimension-repository_id | 190060337 |
| octolytics-dimension-repository_nwo | auth0/.github |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 190060337 |
| octolytics-dimension-repository_network_root_nwo | auth0/.github |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width