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

If context is defined, it is used instead of the firewall #5981

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cookbook/testing/simulating_authentication.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ with a request. The following example demonstrates this technique::
{
$session = $this->client->getContainer()->get('session');

$firewall = 'secured_area';
$firewall = 'secured_area'; // put here firewalls context if defined
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can expand this a bit and put a comment like the following above this line:

// the name of the firewall to authenticate too (replace this with the value
// of the "context" option if it was used in the firewall's configuration)

What do you think?

$token = new UsernamePasswordToken('admin', null, $firewall, array('ROLE_ADMIN'));
$session->set('_security_'.$firewall, serialize($token));
$session->save();
Expand Down