Skip to content

Commit ff10197

Browse files
authored
Merge pull request #3 from grokability/revert-2-postprocessing_middleware
Revert "Initial stab at middelware that reformats SCIM responses"
2 parents 8eba81d + 4bfa1e6 commit ff10197

File tree

2 files changed

+0
-32
lines changed

2 files changed

+0
-32
lines changed

config/scim.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
<?php
22

33
return [
4-
"trace" => env('SCIM_TRACE',false),
5-
// below, if we ever get 'sure' that we can change this default to 'true' we should
6-
"standards_compliance" => env('SCIM_STANDARDS_COMPLIANCE', false),
74
"publish_routes" => true
85
];

src/Middleware/SCIMHeaders.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@
66
use Illuminate\Http\Request;
77
use ArieTimmerman\Laravel\SCIMServer\Exceptions\SCIMException;
88

9-
function undefault_schema(\stdClass $parsed_json)
10-
{
11-
foreach($parsed_json AS $key => $value) {
12-
if (stristr($key,'urn:ietf:params:scim:schemas:core:') !== false) {
13-
unset($parsed_json->{$key}); //yank it out
14-
foreach($value AS $subkey => $subval) { //iterate through *its* subkey/subvals...
15-
// TODO should we check if the original keys exist? Only overwrite them if they don't?
16-
$parsed_json->{$subkey} = $subval;
17-
}
18-
}
19-
}
20-
return $parsed_json;
21-
}
22-
239
class SCIMHeaders
2410
{
2511
public function handle(Request $request, Closure $next)
@@ -29,21 +15,6 @@ public function handle(Request $request, Closure $next)
2915
}
3016

3117
$response = $next($request);
32-
33-
if(config('scim.standards_compliance')) {
34-
$response_content = json_decode($response->content());
35-
36-
if (!$response_content->totalResults) {
37-
$response->setContent(json_encode(undefault_schema($response_content)));
38-
} else {
39-
$final_response = [];
40-
foreach ($response_content->Resources as $index => $object) {
41-
$final_response[] = undefault_schema($object);
42-
}
43-
$response_content->Resources = $final_response;
44-
$response->setContent(json_encode($response_content));
45-
}
46-
}
4718

4819
return $response->header('Content-Type', 'application/scim+json');
4920
}

0 commit comments

Comments
 (0)