Browse Source

Add readme for custom example

master
Adam Pippin 3 years ago
parent
commit
2745fdc84e
  1. 46
      examples/custom/README.md

46
examples/custom/README.md

@ -0,0 +1,46 @@
# 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.
Loading…
Cancel
Save