From 4bfa1e6fe1c6dcfaedee22ea02ce67d82cd60e67 Mon Sep 17 00:00:00 2001 From: Brady Wetherington Date: Tue, 22 Nov 2022 12:15:42 -0800 Subject: [PATCH] Revert "Initial stab at middelware that reformats SCIM responses" --- config/scim.php | 3 --- src/Middleware/SCIMHeaders.php | 29 ----------------------------- 2 files changed, 32 deletions(-) diff --git a/config/scim.php b/config/scim.php index ea1dd00..3b7fbb8 100644 --- a/config/scim.php +++ b/config/scim.php @@ -1,8 +1,5 @@ env('SCIM_TRACE',false), - // below, if we ever get 'sure' that we can change this default to 'true' we should - "standards_compliance" => env('SCIM_STANDARDS_COMPLIANCE', false), "publish_routes" => true ]; diff --git a/src/Middleware/SCIMHeaders.php b/src/Middleware/SCIMHeaders.php index da6a893..a392dd8 100644 --- a/src/Middleware/SCIMHeaders.php +++ b/src/Middleware/SCIMHeaders.php @@ -6,20 +6,6 @@ use Illuminate\Http\Request; use ArieTimmerman\Laravel\SCIMServer\Exceptions\SCIMException; -function undefault_schema(\stdClass $parsed_json) -{ - foreach($parsed_json AS $key => $value) { - if (stristr($key,'urn:ietf:params:scim:schemas:core:') !== false) { - unset($parsed_json->{$key}); //yank it out - foreach($value AS $subkey => $subval) { //iterate through *its* subkey/subvals... - // TODO should we check if the original keys exist? Only overwrite them if they don't? - $parsed_json->{$subkey} = $subval; - } - } - } - return $parsed_json; -} - class SCIMHeaders { public function handle(Request $request, Closure $next) @@ -29,21 +15,6 @@ public function handle(Request $request, Closure $next) } $response = $next($request); - - if(config('scim.standards_compliance')) { - $response_content = json_decode($response->content()); - - if (!$response_content->totalResults) { - $response->setContent(json_encode(undefault_schema($response_content))); - } else { - $final_response = []; - foreach ($response_content->Resources as $index => $object) { - $final_response[] = undefault_schema($object); - } - $response_content->Resources = $final_response; - $response->setContent(json_encode($response_content)); - } - } return $response->header('Content-Type', 'application/scim+json'); }