symfony icon indicating copy to clipboard operation
symfony copied to clipboard

Normalize dashes in JWT permissions/scopes

Open mkilmanas opened this issue 1 year ago • 1 comments

Changes

When converting permissions/scopes to Symfony roles, apply replacement not only for colon (:) character, but also for dash (-) character, as some resources/permissions consist of multiple words and dash is a recommended separator in such cases.

Testing

  • Have a permission/scope in Auth0 token that contains a dash (e.g. read:licence-plates)
  • Convert it to Symfony roles (by getting the roles of the JWT authenticated user/m2m):
    • before: it would return ROLE_READ_LICENCE-PLATES
    • after: it returns ROLE_READ_LICENCE_PLATES

[ ] This change adds test coverage

[ ] This change has been tested on the latest version of Symfony

Checklist

[x] I have read the Auth0 general contribution guidelines

[x] I have read the Auth0 Code of Conduct

[x] All existing and new tests complete without errors

mkilmanas avatar Jan 16 '24 13:01 mkilmanas