You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.4 KiB
47 lines
1.4 KiB
3 years ago
|
# authkit2 - Custom Integration Example
|
||
|
|
||
|
This folder contains an example that demonstrates using authkit2 for
|
||
|
authenticating against a OIDC provider outside of the Laravel framework.
|
||
|
|
||
|
# Setup
|
||
|
|
||
|
Install dependencies (only authkit2) with:
|
||
|
|
||
|
```
|
||
|
$ composer install
|
||
|
```
|
||
|
|
||
|
Configure your application's client credentials and redirect URLs in
|
||
|
`_config.php`.
|
||
|
|
||
|
Note that the OpenID endpoint must include the full path to the realm, e.g. for
|
||
|
Keycloak, `http://127.0.0.1:8080/auth/realms/Test`
|
||
|
|
||
|
# Usage
|
||
|
|
||
|
You can serve this project with PHP's integrated development server. From this
|
||
|
folder, run:
|
||
|
|
||
|
```
|
||
|
$ php -S 127.0.0.1:4444
|
||
|
```
|
||
|
|
||
|
Then access it in your browser at [http://127.0.0.1:4444](http://127.0.0.1:4444/).
|
||
|
|
||
|
Don't forget to register your callback URLs with your OpenID provider.
|
||
|
|
||
|
# Layout
|
||
|
|
||
|
* `_config.php`: Constants to define your configuration.
|
||
|
* `_common.php`: Common code: initialize session, pass configuration to
|
||
|
authkit, helpers for rendering page header/footer
|
||
|
* `index.php`: Basic page to show logged in user's information or provide a
|
||
|
prompt to login.
|
||
|
* `logout.php`: Page to log the user out, redirect them to the provider to
|
||
|
logout, and back to index.
|
||
|
* `login.php`: Initiate the login process and redirect the user to the provider.
|
||
|
* `callback.php`: Where the provider redirects the user back to, receives the
|
||
|
nonce and authorization code, exchanges those for a token, and redirects the
|
||
|
user back to the index.
|
||
|
|