Skip to content

Commit 8de509e

Browse files
committed
minor #17114 [Security] Document the lifetime per link (javiereguiluz)
This PR was merged into the 6.2 branch. Discussion ---------- [Security] Document the lifetime per link Fixes #17034. Commits ------- 19e4760 [Security] Document the lifetime per link
2 parents 9fe0ac8 + 19e4760 commit 8de509e

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

security/login_link.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,8 @@ configuration decisions are discussed:
341341
* `Invalidate Login Links`_
342342
* `Allow a Link to only be Used Once`_
343343

344+
.. _login-link-lifetime:
345+
344346
Limit Login Link Lifetime
345347
~~~~~~~~~~~~~~~~~~~~~~~~~
346348

@@ -398,6 +400,10 @@ seconds). You can customize this using the ``lifetime`` option:
398400
;
399401
};
400402
403+
.. tip::
404+
405+
You can also :ref:`customize the lifetime per link <customizing-link-lifetime>`.
406+
401407
.. _security-login-link-signature:
402408

403409
Invalidate Login Links
@@ -796,3 +802,17 @@ features such as the locale used to generate the link::
796802

797803
// ...
798804
}
805+
806+
.. _customizing-link-lifetime:
807+
808+
By default, generated links use :ref:`the lifetime configured globally <login-link-lifetime>`
809+
but you can change the lifetime per link using the third argument of the
810+
``createLoginLink()`` method::
811+
812+
// the third optional argument is the lifetime in seconds
813+
$loginLinkDetails = $loginLinkHandler->createLoginLink($user, null, 60);
814+
$loginLink = $loginLinkDetails->getUrl();
815+
816+
.. versionadded:: 6.2
817+
818+
The option to customize the link lifetime was introduced in Symfony 6.2.

0 commit comments

Comments
 (0)