1. Go to this page and download the library: Download logonbox/authenticator 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/ */
logonbox / authenticator example snippets
use Authenticator\AuthenticatorClient;
use Logger\AppLogger;
use RemoteService\RemoteServiceImpl;
atorClient = new AuthenticatorClient($remoteService);
$authenticatorClient->debug(true);
$principal = "[email protected]";
$response = $authenticatorClient->authenticate($principal);
$result = $response->verify();
echo $result ? "Verified ....." : "Rejected ......" . PHP_EOL;
} catch (Exception $e) {
echo $e;
}
use Authenticator\AuthenticatorClient;
use Logger\AppLogger;
use RemoteService\RemoteServiceImpl;
eServiceImpl("some.directory", 443, new AppLogger());
$authenticatorClient = new AuthenticatorClient($remoteService);
$user = $_POST["user"];
$authenticatorRequest = $authenticatorClient
->generateRequest($user, "http://localhost/src/sample/server_redirect/authenticator-finish.php?response={response}");
$_SESSION["encodedPayload"] = $authenticatorRequest->getEncodedPayload();
header("Location: " . $authenticatorRequest->getSignUrl(), true, 302);
} catch (Exception $e) {
echo $e;
}
use Authenticator\AuthenticatorClient;
use Authenticator\AuthenticatorRequest;
use Logger\AppLogger;
use RemoteService\RemoteServiceImpl;
codedPayload"];
$remoteService = new RemoteServiceImpl("some.directory", 443, new AppLogger());
$authenticatorClient = new AuthenticatorClient($remoteService);
$authenticatorRequest = new AuthenticatorRequest($authenticatorClient, $encodedPayload);
$authenticatorResponse = $authenticatorRequest->processResponse($response);
echo "The verification result => " . $authenticatorResponse->verify();
} catch (Exception $e) {
echo $e . PHP_EOL;
}
$authenticatorClient->debug(true);
use Authenticator\AuthenticatorClient;
use Logger\MyAppLogger;
use RemoteService\RemoteServiceImpl;
atorClient = new AuthenticatorClient($remoteService);
// ..... logic TODO
} catch (Exception $e) {
echo $e;
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.