Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Security] Add support for encrypted access tokens (JWE) in OIDC#20637

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add support for encrypted access tokens (JWE) in OIDC
This update introduces support for decrypting encrypted access tokens (JWE) in Symfony 7.3. It includes configuration options for enabling encryption, enforcing it, specifying decryption algorithms, and providing decryption keysets. The feature extends flexibility in handling secure tokens alongside existing signing mechanisms.
  • Loading branch information
@Spomky@javiereguiluz
Spomky authored andjaviereguiluz committedMay 27, 2025
commit8b403f7948d9ce2bcec4f63b2783d8a055436a90
27 changes: 24 additions & 3 deletionssecurity/access_token.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -615,8 +615,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 andretrieve the userinfo from it:
Symfony provides a generic ``OidcTokenHandler``that decodes the token,validates
it, andretrieves the userinformation from it. Optionally, the token can be encrypted (JWE):

.. configuration-block::

Expand All@@ -637,6 +637,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

Expand All@@ -662,6 +667,10 @@ it and retrieve the user info from it:
<algorithm>ES256</algorithm>
<algorithm>RS256</algorithm>
<issuer>https://oidc.example.com</issuer>
<encryption enabled="true" enforce="true" keyset="{'keys': [...]}">
<algorithm>ECDH-ES</algorithm>
<algorithm>A128GCM</algorithm>
</encryption>
</oidc>
</token-handler>
</access-token>
Expand All@@ -681,12 +690,20 @@ it and retrieve the user info from it:
->oidc()
// Algorithm used to sign the JWS
->algorithms(['ES256', 'RS256'])
// A JSON-encodedJWK
// A JSON-encodedJWKSet (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":[...]}')

;
};

Expand All@@ -695,6 +712,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

Support for encryption algorithms to decrypt JWEs was introduced in Symfony 7.3.

To enable `OpenID Connect Discovery`_, the ``OidcTokenHandler`` requires the
``symfony/cache`` package to store the OIDC configuration in the cache. If you
haven't installed it yet, run the following command:
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp