Skip to content

Commit 6a3283f

Browse files
nuzzyklebster
andauthored
Update README.MD (#16)
* Task "Build authenticator". (#1) * Task "Build authenticator". * Created Frontegg main class. * Created Helper classes. * Created "readme.md" file. * Created "composer.json" file with package dependencies. * Created tests for base functionality. * Task "Build authenticator". * Update Frontegg main class. * Updated Helper classes. * Updated "readme.md" file. * Updated "composer.json" file "ext-curl" dependency. * Updated tests for base functionality. * Task "Build authenticator". * Update Frontegg main class. * Updated Helper classes. * Updated "readme.md" file. * Updated "composer.json" file "ext-curl" dependency. * Updated tests for base functionality. * Task "Build Authenticator" * Updated code style using CodeSniffer and PhpStan. * Updated "composer.json" * Audits SDK (#2) * Task "Build authenticator". * Created Frontegg main class. * Created Helper classes. * Created "readme.md" file. * Created "composer.json" file with package dependencies. * Created tests for base functionality. * Task "Build authenticator". * Update Frontegg main class. * Updated Helper classes. * Updated "readme.md" file. * Updated "composer.json" file "ext-curl" dependency. * Updated tests for base functionality. * Task "Build authenticator". * Update Frontegg main class. * Updated Helper classes. * Updated "readme.md" file. * Updated "composer.json" file "ext-curl" dependency. * Updated tests for base functionality. * Task "Build Authenticator" * Updated code style using CodeSniffer and PhpStan. * Updated "composer.json" * Task "Audits SDK" * Created new AuditsClient class for API calls to Audit Logs endpoints. * Updated main classes. * Created new tests for Audit Logs classes. * Updated and refactored existing tests. * Updated "readme.md" file. * Task "Audits SDK" * Fixed code styles. * Task "Audits Log" * Small fixes * Events SDK (#4) * Task "Events SDK" * Created basic classes for Events API. * Updated existing classes. * Created tests for Events API. * Other small changes. * Task "Events SDK" * Created basic classes for Events API. * Updated existing classes. * Created tests for Events API. * Other small changes. * Task "Events SDK" * Updated Events classes and tests. * Created class and tests for Slack channel. * Other small updates. * Task "Events SDK" * Fixed code styles. * Task "Events SDK" * Fixed an error with API URL. * Updated basic classes and tests. * Task "Events SDK" * Renamed config services constants. * Frontegg Middleware Proxy (#5) * Added Proxy functionality * Included `psr/http-message`, 'relay/relay', `guzzlehttp/psr7` packages * Intruduced `Proxy` class * Introduced `FronteggAdapter` class * Added `FronteggRequestHeaderResolver` and `FronteggRequestMethodResolver` * Adjusted `FronteggCurlHttpClient` with `DEFAULT_TIMEOUT` constant * Task "Events SDK" * Created basic classes for Events API. * Updated existing classes. * Created tests for Events API. * Other small changes. * Task "Events SDK" * Created basic classes for Events API. * Updated existing classes. * Created tests for Events API. * Other small changes. * Task "Events SDK" * Updated Events classes and tests. * Created class and tests for Slack channel. * Other small updates. * Task "Events SDK" * Fixed code styles. * Task "Frontegg middleware" * Updated Proxy classes. * Created tests for Proxy classes. * Task "Events SDK" * Fixed an error with API URL. * Updated basic classes and tests. * Task "Frontegg Middleware" * Updated basic classes and tests. * Created Proxy filter classes. * Other changes. * Task "Events SDK" * Renamed config services constants. * Task "Frontegg Middleware" * Updated and refactored Proxy classes. * Added new tests for Proxy middleware. * Task "Frontegg Middleware" * Fixed code styles. * Task "Frontegg Middleware" * Fixed merge conflicts. * Task "Frontegg Middleware" * Updated Proxy classes to properly handle POST requests. * Created tests for Proxy API. Co-authored-by: Daniel Kleba <[email protected]> * Task "Docs Update" (#9) * Updated "readme.md" * Task "Code Updates and Refactoring" (#11) * Fixed "composer.json" file to be valid. * Refactored ApiErrors to be a part of ApiErrorTrait. * Refactored getDecodedJsonData() method to be a part of ApiJsonTrait. * Updated directory structure for Events. * Updated Audits GET request to properly send query parameters. * Updated tests. * Other small changes. * Task "Run tests on github on push" (#12) * Added Github workflow to run phpunit tests. * Removed credentials from the tests. * Created phpunit.xml config file * Demo Using Docker Env (#10) * Task "Docker demo for raw PHP" * Created demo environment with docker for raw PHP. * Docker demo for raw PHP * Removed credentials from the code. * Updated code. * Task "Demo site on Docker env" * Updated demo site in "docker/index.php". * Updated "docker-compose.yml" file. * Removed credentials from the tests. * Task "Fix sending event trigger channels bug" (#13) * Updated Events channel classes. * Updated and added tests for new code changes. * Updated "readme.md" file. * Update README file (#15) Co-authored-by: Daniel Kleba <[email protected]>
1 parent 18e90cf commit 6a3283f

File tree

1 file changed

+41
-1
lines changed

1 file changed

+41
-1
lines changed

readme.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,4 +293,44 @@ function handleFronteggUri(RequestInterface $request)
293293

294294
return $response->getBody();
295295
}
296-
````
296+
````
297+
298+
Another example of raw PHP and with adapting request parameters to Psr-7 Request object:
299+
300+
````php
301+
<?php
302+
303+
use Frontegg\Frontegg;
304+
use Psr\Http\Message\RequestInterface;
305+
use GuzzleHttp\Psr7\Request;
306+
307+
$requestMethod = $_SERVER['REQUEST_METHOD'];
308+
$requestUri = str_replace('/api/frontegg', '', $_SERVER['REQUEST_URI']);
309+
$httpHeaders = getallheaders();
310+
$body = http_build_query($requestMethod === 'GET' ? $_GET : $_POST);
311+
// Here you can see how to setup Psr-7 Request object.
312+
$adapterRequest = new Request($requestMethod, $requestUri, $httpHeaders, $body);
313+
314+
$clientId = 'CLIENT_ID';
315+
$apikey = 'API_KEY';
316+
$tenantId = 'THE_TENANT_ID';
317+
$config = [
318+
'clientId' => $clientId,
319+
'clientSecret' => $apikey,
320+
'apiBaseUrl' => 'https://api.test.com/',
321+
'contextResolver' => function(RequestInterface $request) use ($tenantId) {
322+
return [
323+
'tenantId' => $tenantId,
324+
'userId' => 'test-user-id',
325+
'permissions' => [],
326+
];
327+
},
328+
'disableCors' => false,
329+
];
330+
331+
$frontegg = new Frontegg($config);
332+
333+
$response = $frontegg->forward($adapterRequest);
334+
335+
print $response->getBody();
336+
````

0 commit comments

Comments
 (0)