Skip to content

Commit 9c77942

Browse files
committed
minor #21494 [Security] Add documentation for the security:oidc:generate-token command (Jean-Beru)
This PR was merged into the 7.4 branch. Discussion ---------- [Security] Add documentation for the security:oidc:generate-token command Add the documentation about the new `security:oidc:generate-token` command. Fixes #21471 Commits ------- e4c78f8 [Security] Add documentation for the security:oidc:generate-token command
2 parents 22890da + e4c78f8 commit 9c77942

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

security/access_token.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,34 @@ create your own User from the claims, you must
877877
}
878878
}
879879

880+
Creating a OIDC token from the command line
881+
-------------------------------------------
882+
883+
.. versionadded:: 7.4
884+
885+
The ``security:oidc:generate-token`` command was introduced in Symfony 7.4.
886+
887+
The ``security:oidc:generate-token`` command helps you generate JWTs. This is
888+
particularly useful when developing or testing applications that use OIDC
889+
authentication.
890+
891+
To generate a token using the default configuration:
892+
893+
.. code-block:: terminal
894+
895+
# generate a token for the user named "john.doe@example.com"
896+
$ php bin/console security:oidc:generate-token john.doe@example.com
897+
898+
# generate a token when multiple firewall, algorithm or issuer are available
899+
$ php bin/console security:oidc:generate-token john.doe@example.com \
900+
--firewall="api" \
901+
--algorithm="HS256" \
902+
--issuer="https://example.com"
903+
904+
.. note::
905+
906+
The JWK used for signing must have the appropriate `key operation flags`_ set.
907+
880908
Using CAS 2.0
881909
-------------
882910

@@ -1099,3 +1127,4 @@ for :ref:`stateless firewalls <reference-security-stateless>`.
10991127
.. _`OpenID Connect Discovery`: https://openid.net/specs/openid-connect-discovery-1_0.html
11001128
.. _`RFC6750`: https://datatracker.ietf.org/doc/html/rfc6750
11011129
.. _`SAML2 (XML structures)`: https://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html
1130+
.. _`key operation flags`: https://www.iana.org/assignments/jose/jose.xhtml#web-key-operations

0 commit comments

Comments
 (0)