Download the PHP package sngular/sngulauth without Composer
On this page you can find all versions of the php package sngular/sngulauth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package sngulauth
This is the ultimate package for manage Keycloak authentication with Openid Connect
Before start, you need some parameters
- authServerUrl: keycloak auth url
- realm: realm name that has been set up for the project
- clientId: client id name that has been set up for the project
- clientSecret: client secret name that has been set up for the project
- redirectUri: the redirect url to be redirected after successful credentials prompt (this url must be valid on keycloak client configuration)
- encryptionAlgorithm: algorithm to decode the JWT information, default is RS256
- encryptionKeyString: the public key content in one line (without BEGIN PUBLIC KEY and END PUBLIC KEY) in order to decrypt the JWT and get the user info.
The auth process
The src/Provider/Keycloak/Protocol/Connect class needs an array to be instantiated with those parameters:
Then you can build the auth url to redirect user or display a link:
After user insert his credentials on Keycloak login page, it will be redirected to redirectUri parameter, with a code. Now you can fetch a token (League\OAuth2\Client\Token\AccessToken) against keycloak with those code:
Now you can get the resource owner (the user data) against keycloak
And decrypt the token to get the token payload:
All versions of sngulauth with dependencies
PHP Build Version
Package Version
Requires
league/oauth2-client Version
^2.0
firebase/php-jwt Version ^4.0
guzzlehttp/guzzle Version 6.5.0
firebase/php-jwt Version ^4.0
guzzlehttp/guzzle Version 6.5.0
The package sngular/sngulauth contains the following files
Loading the files please wait ....