diff --git a/security/access_token.rst b/security/access_token.rst
index 70c9e21980e..fc5ac2822e9 100644
--- a/security/access_token.rst
+++ b/security/access_token.rst
@@ -875,6 +875,127 @@ create your own User from the claims, you must
}
}
+3) Configure the Oauth2TokenHandler
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Symfony provides a generic access token handler that calls the configured token introspection endpoint to validate the token and retrieve the user information from it.
+It requires the ``symfony/http-client`` package to make the needed HTTP requests. If you haven't installed it yet, run this command:
+
+.. code-block:: terminal
+
+ $ composer require symfony/http-client
+
+First, configure a dedicated scoped HTTP client for the token handler:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+ # config/packages/framework.yaml
+ framework:
+ http_client:
+ scoped_clients:
+ oauth2.client:
+ base_uri: 'https://authorization-server.example.com/introspection'
+ scope: 'https://authorization-server\.example\.com'
+ headers:
+ Authorization: 'Basic Y2xpZW50OnBhc3N3b3Jk'
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+ Basic Y2xpZW50OnBhc3N3b3Jk
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/framework.php
+ use Symfony\Config\FrameworkConfig;
+
+ return static function (FrameworkConfig $framework): void {
+ $framework->httpClient()->scopedClient('oauth2.client')
+ ->baseUri('https://authorization-server.example.com/introspection')
+ ->scope('https://authorization-server\.example\.com')
+ ->header('Authorization', 'Basic Y2xpZW50OnBhc3N3b3Jk') // Introspection Endpoint usually requires client authentication
+ ;
+ };
+
+Then, configure the ``oauth2`` token handler to use this scoped HTTP client:
+
+.. configuration-block::
+
+ .. code-block:: yaml
+
+ # config/packages/security.yaml
+ security:
+ firewalls:
+ main:
+ pattern: ^/
+ access_token:
+ token_handler:
+ oauth2: ~
+ token_extractors: 'header'
+ realm: 'My API'
+
+ .. code-block:: xml
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .. code-block:: php
+
+ // config/packages/security.php
+ use Symfony\Config\SecurityConfig;
+
+ return static function (SecurityConfig $security) {
+ $security->firewall('main')
+ ->accessToken()
+ ->tokenHandler()
+ ->oauth2()
+ ->tokenExtractors('header')
+ ->realm('My API')
+ ;
+ };
+
+.. versionadded:: 7.3
+
+ The support for OAuth2 Token Introspection handler was introduced in Symfony 7.3.
+
Using CAS 2.0
-------------