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.
Adam Pippin 4dbff7e0d3 code formatter 3 years ago
..
README.md Add readme for custom example 3 years ago
_common.php code formatter 3 years ago
_config.php code formatter 3 years ago
callback.php code formatter 3 years ago
composer.json Add example of a custom integration 3 years ago
composer.lock Resolve all issues identified by phan 3 years ago
index.php code formatter 3 years ago
login.php code formatter 3 years ago
logout.php code formatter 3 years ago

README.md

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.

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.