@@ -864,6 +864,95 @@ create your own User from the claims, you must
864864 }
865865 }
866866
867+ Configuring Multiple OIDC Discovery Endpoints
868+ .............................................
869+
870+ .. versionadded :: 7.4
871+
872+ Support for multiple OIDC discovery endpoints was introduced in Symfony 7.4.
873+
874+ The ``OidcTokenHandler `` supports multiple OIDC discovery endpoints, allowing it
875+ to validate tokens from different identity providers:
876+
877+ .. configuration-block ::
878+
879+ .. code-block :: yaml
880+
881+ # config/packages/security.yaml
882+ security :
883+ firewalls :
884+ main :
885+ access_token :
886+ token_handler :
887+ oidc :
888+ algorithms : ['ES256', 'RS256']
889+ audience : ' api-example'
890+ issuers : ['https://oidc1.example.com', 'https://oidc2.example.com']
891+ discovery :
892+ base_uri :
893+ - https://idp1.example.com/realms/demo/
894+ - https://idp2.example.com/realms/demo/
895+ cache :
896+ id : cache.app
897+
898+ .. code-block :: xml
899+
900+ <!-- config/packages/security.xml -->
901+ <?xml version =" 1.0" encoding =" UTF-8" ?>
902+ <srv : container xmlns =" http://symfony.com/schema/dic/security"
903+ xmlns : srv =" http://symfony.com/schema/dic/services"
904+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
905+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
906+ https://symfony.com/schema/dic/services/services-1.0.xsd
907+ http://symfony.com/schema/dic/security
908+ https://symfony.com/schema/dic/security/security-1.0.xsd" >
909+
910+ <config >
911+ <firewall name =" main" >
912+ <access-token >
913+ <token-handler >
914+ <oidc audience =" api-example" >
915+ <algorithm >ES256</algorithm >
916+ <algorithm >RS256</algorithm >
917+ <issuer >https://oidc1.example.com</issuer >
918+ <issuer >https://oidc2.example.com</issuer >
919+ <discovery cache =" cache.app" >
920+ <base-uri >https://idp1.example.com/realms/demo/</base-uri >
921+ <base-uri >https://idp2.example.com/realms/demo/</base-uri >
922+ </discovery >
923+ </oidc >
924+ </token-handler >
925+ </access-token >
926+ </firewall >
927+ </config >
928+ </srv : container >
929+
930+ .. code-block :: php
931+
932+ // config/packages/security.php
933+ use Symfony\Config\SecurityConfig;
934+
935+ return static function (SecurityConfig $security) {
936+ $security->firewall('main')
937+ ->accessToken()
938+ ->tokenHandler()
939+ ->oidc()
940+ ->algorithms(['ES256', 'RS256'])
941+ ->audience('api-example')
942+ ->issuers(['https://oidc1.example.com', 'https://oidc2.example.com'])
943+ ->discovery()
944+ ->baseUri([
945+ 'https://idp1.example.com/realms/demo/',
946+ 'https://idp2.example.com/realms/demo/',
947+ ])
948+ ->cache(['id' => 'cache.app'])
949+ ;
950+ };
951+
952+ The token handler fetches the JWK sets from all configured discovery endpoints
953+ and builds a combined JWK set for token validation. This lets your application
954+ accept and validate tokens from multiple identity providers within a single firewall.
955+
867956Creating a OIDC token from the command line
868957-------------------------------------------
869958
0 commit comments