File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -65,3 +65,8 @@ session_set_save_handler($handler, true);
65
65
$handler = new \ByJG\Session\JwtSession('your.domain.com', 'your super secret key');
66
66
$handler->replaceSessionHandler(true);
67
67
```
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;
Original file line number Diff line number Diff line change 2
2
3
3
require_once __DIR__ . "/../vendor/autoload.php " ;
4
4
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 ();
7
13
8
14
?>
9
15
25
31
<li><a href="setsession.php">Set a session</a></li>
26
32
<li><a href="unsetsession.php">Unset a session</a></li>
27
33
<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>
28
36
</ul>
29
37
</div>
You can’t perform that action at this time.
0 commit comments