Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to use the CSRF REQUEST_TOKEN in Symfony forms #795

Open
ausi opened this issue Jul 26, 2021 · 0 comments
Open

Document how to use the CSRF REQUEST_TOKEN in Symfony forms #795

ausi opened this issue Jul 26, 2021 · 0 comments

Comments

@ausi
Copy link
Member

ausi commented Jul 26, 2021

contao/contao#3214

$this->createFormBuilder(…, [
    'csrf_field_name' => 'REQUEST_TOKEN',
    'csrf_token_manager' => $manager, // @contao.csrf.token_manager
    'csrf_token_id' => $tokenName, // %contao.csrf_token_name%
]);
leofeyer pushed a commit to contao/contao that referenced this issue Aug 3, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #3211
| Docs PR or issue | contao/docs#795

This should make it possible to use request tokens in Symfony forms with the following configuration:

```php
$this->createFormBuilder(…, [
    'csrf_field_name' => 'REQUEST_TOKEN',
    'csrf_token_manager' => $manager, // @contao.csrf.token_manager
    'csrf_token_id' => $tokenName, // %contao.csrf_token_name%
]);
```

**UPDATE 2021-07-26:** Can now be used like this:

```php
$this->createFormBuilder($data, $this->getCsrfFormOptions());
```
or like this:
```php
$this->createFormBuilder($data, array_merge(
    $this->getCsrfFormOptions(),
    [ /* custom options */ ]
));
```

Commits
-------

fdb6e92 Request tokens in Symfony forms
49c2a74 Reuse token validation skip check
094727d Add getCsrfFormOptions method to AbstractController
leofeyer pushed a commit to contao/installation-bundle that referenced this issue Aug 3, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #3211
| Docs PR or issue | contao/docs#795

This should make it possible to use request tokens in Symfony forms with the following configuration:

```php
$this->createFormBuilder(…, [
    'csrf_field_name' => 'REQUEST_TOKEN',
    'csrf_token_manager' => $manager, // @contao.csrf.token_manager
    'csrf_token_id' => $tokenName, // %contao.csrf_token_name%
]);
```

**UPDATE 2021-07-26:** Can now be used like this:

```php
$this->createFormBuilder($data, $this->getCsrfFormOptions());
```
or like this:
```php
$this->createFormBuilder($data, array_merge(
    $this->getCsrfFormOptions(),
    [ /* custom options */ ]
));
```

Commits
-------

fdb6e923 Request tokens in Symfony forms
49c2a74f Reuse token validation skip check
094727d5 Add getCsrfFormOptions method to AbstractController
leofeyer pushed a commit to contao/core-bundle that referenced this issue Aug 3, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes #3211
| Docs PR or issue | contao/docs#795

This should make it possible to use request tokens in Symfony forms with the following configuration:

```php
$this->createFormBuilder(…, [
    'csrf_field_name' => 'REQUEST_TOKEN',
    'csrf_token_manager' => $manager, // @contao.csrf.token_manager
    'csrf_token_id' => $tokenName, // %contao.csrf_token_name%
]);
```

**UPDATE 2021-07-26:** Can now be used like this:

```php
$this->createFormBuilder($data, $this->getCsrfFormOptions());
```
or like this:
```php
$this->createFormBuilder($data, array_merge(
    $this->getCsrfFormOptions(),
    [ /* custom options */ ]
));
```

Commits
-------

fdb6e923 Request tokens in Symfony forms
49c2a74f Reuse token validation skip check
094727d5 Add getCsrfFormOptions method to AbstractController
bezin pushed a commit to bezin/contao that referenced this issue Nov 26, 2021
Description
-----------

| Q                | A
| -----------------| ---
| Fixed issues     | Fixes contao#3211
| Docs PR or issue | contao/docs#795

This should make it possible to use request tokens in Symfony forms with the following configuration:

```php
$this->createFormBuilder(…, [
    'csrf_field_name' => 'REQUEST_TOKEN',
    'csrf_token_manager' => $manager, // @contao.csrf.token_manager
    'csrf_token_id' => $tokenName, // %contao.csrf_token_name%
]);
```

**UPDATE 2021-07-26:** Can now be used like this:

```php
$this->createFormBuilder($data, $this->getCsrfFormOptions());
```
or like this:
```php
$this->createFormBuilder($data, array_merge(
    $this->getCsrfFormOptions(),
    [ /* custom options */ ]
));
```

Commits
-------

fdb6e92 Request tokens in Symfony forms
49c2a74 Reuse token validation skip check
094727d Add getCsrfFormOptions method to AbstractController
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants