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);
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;
Original file line number Diff line number Diff line change 22
33require_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
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>
You can’t perform that action at this time.
0 commit comments