From 6a3283f7a89aee6f877ac03a2d4974bf388ffafe Mon Sep 17 00:00:00 2001 From: Dmitriy Svetlichniy Date: Mon, 21 Sep 2020 12:35:35 +0300 Subject: [PATCH] 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 * 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 --- readme.md | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/readme.md b/readme.md index c5dab44..7964230 100644 --- a/readme.md +++ b/readme.md @@ -293,4 +293,44 @@ function handleFronteggUri(RequestInterface $request) return $response->getBody(); } -```` \ No newline at end of file +```` + +Another example of raw PHP and with adapting request parameters to Psr-7 Request object: + +````php + $clientId, + 'clientSecret' => $apikey, + 'apiBaseUrl' => 'https://api.test.com/', + 'contextResolver' => function(RequestInterface $request) use ($tenantId) { + return [ + 'tenantId' => $tenantId, + 'userId' => 'test-user-id', + 'permissions' => [], + ]; + }, + 'disableCors' => false, +]; + +$frontegg = new Frontegg($config); + +$response = $frontegg->forward($adapterRequest); + +print $response->getBody(); +````