Skip to content

Commit 341fe34

Browse files
committed
fix for #600
1 parent 8c0bb51 commit 341fe34

File tree

5 files changed

+27
-0
lines changed

5 files changed

+27
-0
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ You can tune the middleware behavior using middleware specific configuration par
622622
- "dbAuth.usernameColumn": The users table column that holds usernames ("username")
623623
- "dbAuth.passwordColumn": The users table column that holds passwords ("password")
624624
- "dbAuth.returnedColumns": The columns returned on successful login, empty means 'all' ("")
625+
- "dbAuth.sessionName": The name of the PHP session that is started ("")
625626
- "jwtAuth.mode": Set to "optional" if you want to allow anonymous access ("required")
626627
- "jwtAuth.header": Name of the header containing the JWT token ("X-Authorization")
627628
- "jwtAuth.leeway": The acceptable number of seconds of clock skew ("5")
@@ -630,9 +631,11 @@ You can tune the middleware behavior using middleware specific configuration par
630631
- "jwtAuth.algorithms": The algorithms that are allowed, empty means 'all' ("")
631632
- "jwtAuth.audiences": The audiences that are allowed, empty means 'all' ("")
632633
- "jwtAuth.issuers": The issuers that are allowed, empty means 'all' ("")
634+
- "jwtAuth.sessionName": The name of the PHP session that is started ("")
633635
- "basicAuth.mode": Set to "optional" if you want to allow anonymous access ("required")
634636
- "basicAuth.realm": Text to prompt when showing login ("Username and password required")
635637
- "basicAuth.passwordFile": The file to read for username/password combinations (".htpasswd")
638+
- "basicAuth.sessionName": The name of the PHP session that is started ("")
636639
- "reconnect.driverHandler": Handler to implement retrieval of the database driver ("")
637640
- "reconnect.addressHandler": Handler to implement retrieval of the database address ("")
638641
- "reconnect.portHandler": Handler to implement retrieval of the database port ("")

api.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7177,6 +7177,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
71777177
{
71787178
if (session_status() == PHP_SESSION_NONE) {
71797179
if (!headers_sent()) {
7180+
$sessionName = $this->getProperty('sessionName', '');
7181+
if ($sessionName) {
7182+
session_name($sessionName);
7183+
}
71807184
session_start();
71817185
}
71827186
}
@@ -7358,6 +7362,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
73587362
{
73597363
if (session_status() == PHP_SESSION_NONE) {
73607364
if (!headers_sent()) {
7365+
$sessionName = $this->getProperty('sessionName', '');
7366+
if ($sessionName) {
7367+
session_name($sessionName);
7368+
}
73617369
session_start();
73627370
}
73637371
}
@@ -7729,6 +7737,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
77297737
{
77307738
if (session_status() == PHP_SESSION_NONE) {
77317739
if (!headers_sent()) {
7740+
$sessionName = $this->getProperty('sessionName', '');
7741+
if ($sessionName) {
7742+
session_name($sessionName);
7743+
}
77327744
session_start();
77337745
}
77347746
}

src/Tqdev/PhpCrudApi/Middleware/BasicAuthMiddleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
8181
{
8282
if (session_status() == PHP_SESSION_NONE) {
8383
if (!headers_sent()) {
84+
$sessionName = $this->getProperty('sessionName', '');
85+
if ($sessionName) {
86+
session_name($sessionName);
87+
}
8488
session_start();
8589
}
8690
}

src/Tqdev/PhpCrudApi/Middleware/DbAuthMiddleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
3333
{
3434
if (session_status() == PHP_SESSION_NONE) {
3535
if (!headers_sent()) {
36+
$sessionName = $this->getProperty('sessionName', '');
37+
if ($sessionName) {
38+
session_name($sessionName);
39+
}
3640
session_start();
3741
}
3842
}

src/Tqdev/PhpCrudApi/Middleware/JwtAuthMiddleware.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
127127
{
128128
if (session_status() == PHP_SESSION_NONE) {
129129
if (!headers_sent()) {
130+
$sessionName = $this->getProperty('sessionName', '');
131+
if ($sessionName) {
132+
session_name($sessionName);
133+
}
130134
session_start();
131135
}
132136
}

0 commit comments

Comments
 (0)