Skip to content

Commit c4167c6

Browse files
committed
Update README.md
1 parent d389e62 commit c4167c6

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,8 @@ session_set_save_handler($handler, true);
6565
$handler = new \ByJG\Session\JwtSession('your.domain.com', 'your super secret key');
6666
$handler->replaceSessionHandler(true);
6767
```
68+
69+
### How it works
70+
71+
We store a cookie named AUTH_BEARER_<context name> with the session name. The PHPSESSID cookie is still created because
72+
PHP create it by default but we do not use it;

webtest/index.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22

33
require_once __DIR__ . "/../vendor/autoload.php";
44

5-
$handler = new \ByJG\Session\JwtSession('api.com.br', '1234567890');
6-
$handler->replaceSessionHandler(true);
5+
if (!isset($_REQUEST['turnoff'])) { // Just for turnoff the session
6+
$handler = new \ByJG\Session\JwtSession('api.com.br', '1234567890');
7+
$handler->replaceSessionHandler(true);
8+
} else {
9+
echo "<H1>JWT Session is disabled</H1>";
10+
}
11+
12+
session_start();
713

814
?>
915

@@ -25,5 +31,7 @@
2531
<li><a href="setsession.php">Set a session</a></li>
2632
<li><a href="unsetsession.php">Unset a session</a></li>
2733
<li><a href="destroy.php">Destroy all session</a></li>
34+
<li><a href="index.php">Refresh Page</a></li>
35+
<li><a href="index.php?turnoff=true">Turnoff JwtSession</a></li>
2836
</ul>
2937
</div>

0 commit comments

Comments
 (0)