@@ -343,9 +343,11 @@ and configure the service ID as the ``success_handler``:
343
343
Using OpenID Connect (OIDC)
344
344
---------------------------
345
345
346
- `OpenID Connect (OIDC) `_ is the third generation of OpenID technology and it's a RESTful HTTP API that uses
347
- JSON as its data format. OpenID Connect is an authentication layer on top of the OAuth 2.0 authorization framework.
348
- It allows to verify the identity of an end user based on the authentication performed by an authorization server.
346
+ `OpenID Connect (OIDC) `_ is the third generation of OpenID technology and it's a
347
+ RESTful HTTP API that uses JSON as its data format. OpenID Connect is an
348
+ authentication layer on top of the OAuth 2.0 authorization framework. It allows
349
+ to verify the identity of an end user based on the authentication performed by
350
+ an authorization server.
349
351
350
352
.. caution ::
351
353
@@ -358,15 +360,15 @@ It allows to verify the identity of an end user based on the authentication perf
358
360
359
361
The ``OidcUserInfoTokenHandler `` class was introduced in Symfony 6.3.
360
362
361
- .. note ::
363
+ The ``OidcUserInfoTokenHandler `` requires the ``symfony/http-client `` package to
364
+ make the needed HTTP requests. If you haven't installed it yet, run this command:
362
365
363
- The ``OidcUserInfoTokenHandler `` requires ``symfony/http-client `` package:
364
-
365
- .. code-block :: terminal
366
+ .. code-block :: terminal
366
367
367
- $ composer require symfony/http-client
368
+ $ composer require symfony/http-client
368
369
369
- Symfony provides a generic OidcUserInfoTokenHandler to call your OIDC server and retrieve the user info:
370
+ Symfony provides a generic ``OidcUserInfoTokenHandler `` to call your OIDC server
371
+ and retrieve the user info:
370
372
371
373
.. configuration-block ::
372
374
@@ -422,11 +424,8 @@ Symfony provides a generic OidcUserInfoTokenHandler to call your OIDC server and
422
424
;
423
425
};
424
426
425
- .. tip ::
426
-
427
- Following the `OpenID Connect Specification `_, the `sub ` claim
428
- is used as user identifier by default. To use another claim,
429
- specify it on the configuration:
427
+ Following the `OpenID Connect Specification `_, the ``sub `` claim is used as user
428
+ identifier by default. To use another claim, specify it on the configuration:
430
429
431
430
.. configuration-block ::
432
431
@@ -484,12 +483,9 @@ Symfony provides a generic OidcUserInfoTokenHandler to call your OIDC server and
484
483
;
485
484
};
486
485
487
- .. tip ::
488
-
489
- The ``oidc_user_info `` token handler automatically creates
490
- an HTTP client with the specified configuration. If you
491
- prefer using your own client, you can specify the service
492
- name via the ``client `` option:
486
+ The ``oidc_user_info `` token handler automatically creates an HTTP client with
487
+ the specified configuration. If you prefer using your own client, you can
488
+ specify the service name via the ``client `` option:
493
489
494
490
.. configuration-block ::
495
491
@@ -541,8 +537,9 @@ Symfony provides a generic OidcUserInfoTokenHandler to call your OIDC server and
541
537
;
542
538
};
543
539
544
- By default, the ``OidcUserInfoTokenHandler `` creates an OidcUser with the claims. To create your own User from the
545
- claims, you must :doc: `create your own UserProvider </security/user_providers >`::
540
+ By default, the ``OidcUserInfoTokenHandler `` creates an ``OidcUser `` with the
541
+ claims. To create your own user object from the claims, you must
542
+ :doc: `create your own UserProvider </security/user_providers >`::
546
543
547
544
// src/Security/Core/User/OidcUserProvider.php
548
545
use Symfony\Component\Security\Core\User\AttributesBasedUserProviderInterface;
@@ -551,7 +548,7 @@ claims, you must :doc:`create your own UserProvider </security/user_providers>`:
551
548
{
552
549
public function loadUserByIdentifier(string $identifier, array $attributes = []): UserInterface
553
550
{
554
- // do some magic
551
+ // implement your own logic to load and return the user object
555
552
}
556
553
}
557
554
@@ -562,18 +559,18 @@ claims, you must :doc:`create your own UserProvider </security/user_providers>`:
562
559
563
560
The ``OidcTokenHandler `` class was introduced in Symfony 6.3.
564
561
565
- .. note ::
562
+ The ``OidcTokenHandler `` requires ``web-token/jwt-signature ``,
563
+ ``web-token/jwt-checker `` and ``web-token/jwt-signature-algorithm-ecdsa ``
564
+ packages. If you haven't installed them yet, run these commands:
566
565
567
- The ``OidcTokenHandler `` requires ``web-token/jwt-signature ``, ``web-token/jwt-checker `` and
568
- ``web-token/jwt-signature-algorithm-ecdsa `` packages:
569
-
570
- .. code-block :: terminal
566
+ .. code-block :: terminal
571
567
572
- $ composer require web-token/jwt-signature
573
- $ composer require web-token/jwt-checker
574
- $ composer require web-token/jwt-signature-algorithm-ecdsa
568
+ $ composer require web-token/jwt-signature
569
+ $ composer require web-token/jwt-checker
570
+ $ composer require web-token/jwt-signature-algorithm-ecdsa
575
571
576
- Symfony provides a generic OidcTokenHandler to decode your token, validate it and retrieve the user info from it:
572
+ Symfony provides a generic ``OidcTokenHandler `` to decode your token, validate
573
+ it and retrieve the user info from it:
577
574
578
575
.. configuration-block ::
579
576
@@ -633,11 +630,9 @@ Symfony provides a generic OidcTokenHandler to decode your token, validate it an
633
630
;
634
631
};
635
632
636
- .. tip ::
637
-
638
- Following the `OpenID Connect Specification `_, the `sub ` claim
639
- is used by default as user identifier. To use another claim,
640
- specify it on the configuration:
633
+ Following the `OpenID Connect Specification `_, the ``sub `` claim is used by
634
+ default as user identifier. To use another claim, specify it on the
635
+ configuration:
641
636
642
637
.. configuration-block ::
643
638
@@ -697,11 +692,8 @@ Symfony provides a generic OidcTokenHandler to decode your token, validate it an
697
692
;
698
693
};
699
694
700
- .. tip ::
701
-
702
- The ``oidc `` token handler also check for the token audience.
703
- By default, this audience is optional. To enable this check,
704
- add the ``audience `` option:
695
+ The ``oidc `` token handler also checks for the token audience. By default, this
696
+ audience is optional. To enable this check, add the ``audience `` option:
705
697
706
698
.. configuration-block ::
707
699
@@ -761,8 +753,9 @@ Symfony provides a generic OidcTokenHandler to decode your token, validate it an
761
753
;
762
754
};
763
755
764
- By default, the OidcTokenHandler creates an OidcUser with the claims. To create your own User from the claims,
765
- you must :doc: `create your own UserProvider </security/user_providers >`::
756
+ By default, the ``OidcTokenHandler `` creates an ``OidcUser `` with the claims. To
757
+ create your own User from the claims, you must
758
+ :doc: `create your own UserProvider </security/user_providers >`::
766
759
767
760
// src/Security/Core/User/OidcUserProvider.php
768
761
use Symfony\Component\Security\Core\User\AttributesBasedUserProviderInterface;
@@ -771,7 +764,7 @@ you must :doc:`create your own UserProvider </security/user_providers>`::
771
764
{
772
765
public function loadUserByIdentifier(string $identifier, array $attributes = []): UserInterface
773
766
{
774
- // do some magic
767
+ // implement your own logic to load and return the user object
775
768
}
776
769
}
777
770
0 commit comments