Quellcode durchsuchen

fix(endpoint): allow registered endpoint setup calls

Co-authored-by: Cursor <cursoragent@cursor.com>
marcofalabretti vor 2 Wochen
Ursprung
Commit
d7fcd95d85
1 geänderte Dateien mit 10 neuen und 1 gelöschten Zeilen
  1. 10
    1
      app/Http/Middleware/EndpointTokenMiddleware.php

+ 10
- 1
app/Http/Middleware/EndpointTokenMiddleware.php Datei anzeigen

@@ -16,6 +16,9 @@ class EndpointTokenMiddleware
16 16
      */
17 17
     public function handle(Request $request, Closure $next): Response
18 18
     {
19
+        $statiConsentiti = [Endpoint::ATTIVO, Endpoint::REGISTRATO];
20
+
21
+        
19 22
         $token = $request->header('token-endpoint');
20 23
         if(!$token){
21 24
             Log::error('token-endpoint');
@@ -29,17 +32,23 @@ class EndpointTokenMiddleware
29 32
             Log::error('endpoint non trovato con token ');
30 33
             return response()->json(['message' => 'Endpoint non trovato con token ', 'status' => 'error', 'success' => false], 404);
31 34
         }
32
-        if ($endpoint->status !== Endpoint::ATTIVO) {
35
+
36
+
37
+        if (! in_array($endpoint->status, $statiConsentiti, true)) {
38
+            
33 39
             Log::warning('Endpoint non attivo', [
34 40
                 'endpoint_id' => $endpoint->id,
35 41
                 'status' => $endpoint->status,
36 42
             ]);
43
+
37 44
             return response()->json([
38 45
                 'message' => 'Endpoint non attivo',
39 46
                 'status' => 'error',
40 47
                 'success' => false,
41 48
             ], 403);
42 49
         }
50
+
51
+
43 52
         $request->merge(['endpoint' => $endpoint->makeHidden(['product_key', 'secret', 'deeplink_token', 'token'])]);
44 53
         return $next($request);
45 54
     }

Laden…
Abbrechen
Speichern