You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
change: use RFC 9535 syntax for jwt-role-claim-key config
BREAKING CHANGE
On top of it, slice operator can be used by adding the pipe
symbol at the end like `$.roles[0] | [1:]`.
Signed-off-by: Taimoor Zaeem <taimoorzaeem@gmail.com>
Copy file name to clipboardExpand all lines: docs/references/auth.rst
+13-23Lines changed: 13 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -224,17 +224,11 @@ It's recommended to leave the JWT cache enabled as our load tests indicate ~20%
224
224
JWT Role Extraction
225
225
-------------------
226
226
227
-
A JSPath DSL that specifies the location of the :code:`role` key in the JWT claims. It's configured by :ref:`jwt-role-claim-key`. This can be used to consume a JWT provided by a third party service like Auth0, Okta, Microsoft Entra or Keycloak.
227
+
JSON Path (`RFC 9535 <https://www.rfc-editor.org/rfc/rfc9535.html>`_) can be specified for the location of the :code:`role` key in the JWT claims. It's configured by :ref:`jwt-role-claim-key`. This can be used to consume a JWT provided by a third party service like Auth0, Okta, Microsoft Entra or Keycloak.
228
228
229
-
The DSL follows the `JSONPath <https://goessner.net/articles/JsonPath/>`_ expression grammar with extended string comparison operators. Supported operators are:
229
+
You can quickly try out JSON Path by visiting https://serdejsonpath.live/. If result has multiple values, first one gets selected.
230
230
231
-
- ``==`` selects the first array element that exactly matches the right operand
232
-
- ``!=`` selects the first array element that does not match the right operand
233
-
- ``^==`` selects the first array element that starts with the right operand
234
-
- ``==^`` selects the first array element that ends with the right operand
235
-
- ``*==`` selects the first array element that contains the right operand
236
-
237
-
The selected role value can also be sliced using the slice operator ``[a:b]``. It is similar to `slice operator in python <https://docs.python.org/3/library/functions.html#slice>`_. Negative index values are also supported. The syntax is as:
231
+
Optionally, the result can be sliced by using the slice operator ``[a:b]`` after putting a pipe symbol like ``$.roles[0] | [1:]``. It is similar to `slice operator in python <https://docs.python.org/3/library/functions.html#slice>`_. Negative index values are also supported. The syntax is as:
238
232
239
233
- ``[a:b]`` take slice from index ``a`` up to ``b``
240
234
- ``[a:]`` take slice from index ``a`` to end
@@ -250,30 +244,26 @@ Usage examples:
250
244
.. code:: bash
251
245
252
246
# {"postgrest":{"roles": ["other", "author"]}}
253
-
# the DSL accepts characters that are alphanumerical or one of "_$@" as keys
254
-
jwt-role-claim-key = ".postgrest.roles[1]"
247
+
#Escape the dollar with another $ sign in the config file
The string comparison operators are implemented as a custom extension to the JSPath and does not strictly follow the `RFC 9535 <https://www.rfc-editor.org/rfc/rfc9535.html>`_.
266
+
Note that in our implementation, only `search()` function from JSON Path is available for filtering.
0 commit comments