Skip to content

Commit

Permalink
Update authentication.md
Browse files Browse the repository at this point in the history
[skip ci]
  • Loading branch information
jasny committed Apr 19, 2020
1 parent 2e75f94 commit 4ea8cf3
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,22 @@ $auth = (new Auth($levels, new AuthStorage()))
->withEventDispatcher(new EventDispatcher($listeners));
```

#### Session fixation

In a [session fixation attack](https://en.wikipedia.org/wiki/Session_fixation), an attacker gets hold of user's session id
and keeps using it. In order to mitigate such an attack, the session id should be regenerated on login and the session
should be destroyed on logout.

```php
$listeners = (new ListenerProvider())
->withListener(function(Event\Login $login): void {
session_regenerate_id();
})
->withListener(function(Event\Logout $logout): void {
session_destroy();
});
```

### Recalc

Recalculate the authz roles and store the current auth information in the session.
Expand Down

0 comments on commit 4ea8cf3

Please sign in to comment.