File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
src/Tqdev/PhpCrudApi/Middleware
tests/functional/002_auth Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,9 @@ public function handle(Request $request): Response
90
90
if (!$ validUser ) {
91
91
return $ this ->responder ->error (ErrorCode::AUTHENTICATION_FAILED , $ username );
92
92
}
93
- session_regenerate_id ();
93
+ if (!headers_sent ()) {
94
+ session_regenerate_id ();
95
+ }
94
96
}
95
97
if (!isset ($ _SESSION ['username ' ]) || !$ _SESSION ['username ' ]) {
96
98
$ authenticationMode = $ this ->getProperty ('mode ' , 'required ' );
Original file line number Diff line number Diff line change @@ -107,7 +107,9 @@ public function handle(Request $request): Response
107
107
if (empty ($ claims )) {
108
108
return $ this ->responder ->error (ErrorCode::AUTHENTICATION_FAILED , 'JWT ' );
109
109
}
110
- session_regenerate_id ();
110
+ if (!headers_sent ()) {
111
+ session_regenerate_id ();
112
+ }
111
113
}
112
114
if (empty ($ _SESSION ['claims ' ])) {
113
115
$ authenticationMode = $ this ->getProperty ('mode ' , 'required ' );
Original file line number Diff line number Diff line change 1
1
GET /records/invisibles/e42c77c6-06a4-4502-816c-d112c7142e6d
2
- Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6IjE1MzgyMDc2MDUiLCJleHAiOjE1MzgyMDc2MzV9.Z5px_GT15TRKhJCTHhDt5Z6K6LRDSFnLj8U5ok9l7gw
2
+ X- Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWUsImlhdCI6IjE1MzgyMDc2MDUiLCJleHAiOjE1MzgyMDc2MzV9.Z5px_GT15TRKhJCTHhDt5Z6K6LRDSFnLj8U5ok9l7gw
3
3
===
4
4
200
5
5
Content-Type: application/json
@@ -16,7 +16,7 @@ Content-Length: 45
16
16
{"id":"e42c77c6-06a4-4502-816c-d112c7142e6d"}
17
17
===
18
18
GET /records/invisibles/e42c77c6-06a4-4502-816c-d112c7142e6d
19
- Authorization: Bearer invalid
19
+ X- Authorization: Bearer invalid
20
20
===
21
21
403
22
22
Content-Type: application/json
You can’t perform that action at this time.
0 commit comments