Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions security/access_token.rst
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,34 @@ create your own User from the claims, you must
}
}

Creating a OIDC token from the command line
-------------------------------------------

.. versionadded:: 7.4

The ``security:oidc:generate-token`` command was introduced in Symfony 7.4.

The ``security:oidc:generate-token`` command helps you generate JWTs. This is
particularly useful when developing or testing applications that use OIDC
authentication.

To generate a token using the default configuration:

.. code-block:: terminal

# generate a token for the user named "john.doe@example.com"
$ php bin/console security:oidc:generate-token john.doe@example.com

# generate a token when multiple firewall, algorithm or issuer are available
$ php bin/console security:oidc:generate-token john.doe@example.com \
--firewall="api" \
--algorithm="HS256" \
--issuer="https://example.com"

.. note::

The JWK used for signing must have the appropriate `key operation flags`_ set.

Using CAS 2.0
-------------

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