digitalcz / oidc-discovery
PHP implementation of https://openid.net/specs/openid-connect-discovery-1_0.html
v0.2.0
2021-11-04 06:38 UTC
Requires
- php: ^8.0
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^1.0
- psr/simple-cache: ^1.0
Requires (Dev)
- dealerdirect/phpcodesniffer-composer-installer: ^0.7.0
- nyholm/nsa: ^1.3.0
- nyholm/psr7: ^1.4.1
- php-http/curl-client: ^2.2.0
- php-http/discovery: ^1.14.1
- php-http/mock-client: ^1.5.0
- phpstan/extension-installer: ^1.1.0
- phpstan/phpstan: ^0.12.84
- phpstan/phpstan-phpunit: ^0.12.18
- phpstan/phpstan-strict-rules: ^0.12.9
- phpunit/phpunit: ^9.5.10
- slevomat/coding-standard: ^7.0.16
- squizlabs/php_codesniffer: ^3.5.8
- symfony/cache: ^5.3.8
- symfony/var-dumper: ^5.3
- 0.x-dev
- v0.2.0
- v0.1.0
- dev-dependabot/github_actions/actions/cache-3.0.11
- dev-dependabot/github_actions/actions/checkout-3.1.0
- dev-dependabot/github_actions/codecov/codecov-action-3.1.1
- dev-dependabot/composer/slevomat/coding-standard-tw-7.0.16or-tw-8.0.0
- dev-dependabot/composer/psr/simple-cache-tw-1.0or-tw-3.0
This package is auto-updated.
Last update: 2024-12-14 09:05:59 UTC
README
PHP implementation of https://openid.net/specs/openid-connect-discovery-1_0.html
Install
Via Composer
$ composer require digitalcz/oidc-discovery
Usage
If php-http/discovery
package is present, DiscoveryFactory will use it to find PSR18 client and PSR17 factory.
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory; $discoverer = DiscovererFactory::create() $providerMetadata = $discoverer->discover('https://accounts.google.com/.well-known/openid-configuration'); $issuer = $providerMetadata->issuer(); // https://accounts.google.com $tokenEndpoint = $providerMetadata->tokenEndpoint(); // https://oauth2.googleapis.com/token
otherwise, you can provide these manually
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory; use Http\Client\Curl\Client; use Nyholm\Psr7\Factory\Psr17Factory; $client = new Client(); $requestFactory = new Psr17Factory(); $discoverer = DiscovererFactory::create($client, $requestFactory);
Add cache to avoid unnecessary calls
use DigitalCz\OpenIDConnect\Discovery\DiscovererFactory; use Symfony\Component\Cache\Adapter\FilesystemAdapter use Symfony\Component\Cache\Psr16Cache; $cache = new Psr16Cache(new FilesystemAdapter()) $discoverer = DiscovererFactory::create(cache: $cache, cacheTtl: 1800);
See examples for more
Change log
Please see CHANGELOG for more information on what has changed recently.
Testing
$ composer csfix # fix codestyle $ composer checks # run all checks # or separately $ composer tests # run phpunit $ composer phpstan # run phpstan $ composer cs # run codesniffer
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email devs@digital.cz instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.