PHP code example of tillikum / zf2-cas-authentication-adapter

1. Go to this page and download the library: Download tillikum/zf2-cas-authentication-adapter 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/ */

    

tillikum / zf2-cas-authentication-adapter example snippets




use Tillikum\Authentication\Adapter\Cas as CasAdapter;
use Zend\Authentication;
use Zend\Http;

$httpClient = new Http\Client();

/** Standalone **/

$adapter = new CasAdapter(
    $httpClient,
    'http://localhost/cas'
);

// You'll need to do this in response to requests to your system:
$adapter->setServiceValidateParameters(
    array(
        'service' => 'http://my/current/url',
        'ticket' => 'ST-ACME-123',
    )
);

$result = $adapter->authenticate();

/** Plugged in to Zend\Authentication **/

// Assuming we're still using the $adapter constructed above:

$authService = new Authentication\AuthenticationService(
    new Authentication\Storage\NonPersistent(),
    $adapter
);

$result = $authService->authenticate();



$httpClient = new Zend\Http\Client();
$httpClient->setOptions(
    array(
        'sslcapath' => '/etc/ssl/certs'
    )
);

// ... Pass the modified HTTP client to the adapter as usual ...