diff --git a/security/access_token.rst b/security/access_token.rst
index c0ff4692676..a77a5332215 100644
--- a/security/access_token.rst
+++ b/security/access_token.rst
@@ -546,7 +546,8 @@ If you haven't installed it yet, run this command:
$ composer require web-token/jwt-library
Symfony provides a generic ``OidcTokenHandler`` to decode your token, validate
-it and retrieve the user info from it:
+it and retrieve the user info from it.
+Optionally, the token may be encrypted (JWE):
.. configuration-block::
@@ -567,6 +568,11 @@ it and retrieve the user info from it:
audience: 'api-example'
# Issuers (`iss` claim): required for validation purpose
issuers: ['https://oidc.example.com']
+ encryption:
+ enabled: true # Default to false
+ enforce: false # Default to false, requires an encrypted token when true
+ algorithms: ['ECDH-ES', 'A128GCM']
+ keyset: '{"keys": [...]}' # Encryption private keyset
.. code-block:: xml
@@ -592,6 +598,10 @@ it and retrieve the user info from it:
ES256
RS256
https://oidc.example.com
+
+ ECDH-ES
+ A128GCM
+
@@ -611,12 +621,20 @@ it and retrieve the user info from it:
->oidc()
// Algorithm used to sign the JWS
->algorithms(['ES256', 'RS256'])
- // A JSON-encoded JWK
+ // A JSON-encoded JWKSet (public keys)
->keyset('{"keys":[{"kty":"...","k":"..."}]}')
// Audience (`aud` claim): required for validation purpose
->audience('api-example')
// Issuers (`iss` claim): required for validation purpose
->issuers(['https://oidc.example.com'])
+ ->encryption()
+ ->enabled(true) //Default to false
+ ->enforce(false) //Default to false, requires an encrypted token when true
+ // Algorithm used to decrypt the JWE
+ ->algorithms(['ECDH-ES', 'A128GCM'])
+ // A JSON-encoded JWKSet (private keys)
+ ->keyset('{"keys":[...]}')
+
;
};
@@ -625,6 +643,10 @@ it and retrieve the user info from it:
The support of multiple algorithms to sign the JWS was introduced in Symfony 7.1.
In previous versions, only the ``ES256`` algorithm was supported.
+.. versionadded:: 7.3
+
+ The support of the encryption algorithms to decrypt the JWE was introduced in Symfony 7.3.
+
Following the `OpenID Connect Specification`_, the ``sub`` claim is used by
default as user identifier. To use another claim, specify it on the
configuration: