1. Go to this page and download the library: Download maenbn/openamauth library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
maenbn / openamauth example snippets
// Construct parameters are address of your OpenAm server, realm (optional), deploy URI (optional)
$config = new \Maenbn\OpenAmAuth\Config('https://myopenam.com', 'people', 'openam');
// OpenAm instance
$openAm = \Maenbn\OpenAmAuth\Factories\OpenAmFactory::create($config);
// Returns a bool or throws and exception if not token ID is set
$valid = $openAm->setToken($tokenId)->validateTokenId();
// Returns a stdClass with the user's details or null if the token ID and user ID have not been set
$user = $openAm->setToken($tokenId)->setUid($uid)->setUser()->getUser();
// If successful authenicate has been ran
if($openAm->authenticate('username', 'password'){
$user = $openAm->getUser();
// Further successful authenication logic ...
}
// Return a bool based of success of log out
$openAm->setTokenId($tokenId)->logout();