Skip to content

Commit

Permalink
Update README.MD (#16)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
nuzzy and klebster authored Sep 21, 2020
1 parent 18e90cf commit 6a3283f
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -293,4 +293,44 @@ function handleFronteggUri(RequestInterface $request)

return $response->getBody();
}
````
````

Another example of raw PHP and with adapting request parameters to Psr-7 Request object:

````php
<?php

use Frontegg\Frontegg;
use Psr\Http\Message\RequestInterface;
use GuzzleHttp\Psr7\Request;

$requestMethod = $_SERVER['REQUEST_METHOD'];
$requestUri = str_replace('/api/frontegg', '', $_SERVER['REQUEST_URI']);
$httpHeaders = getallheaders();
$body = http_build_query($requestMethod === 'GET' ? $_GET : $_POST);
// Here you can see how to setup Psr-7 Request object.
$adapterRequest = new Request($requestMethod, $requestUri, $httpHeaders, $body);

$clientId = 'CLIENT_ID';
$apikey = 'API_KEY';
$tenantId = 'THE_TENANT_ID';
$config = [
'clientId' => $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();
````

0 comments on commit 6a3283f

Please sign in to comment.