PHP code example of ec-europa / ecas-phpcas-parser

1. Go to this page and download the library: Download ec-europa/ecas-phpcas-parser 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/ */

    

ec-europa / ecas-phpcas-parser example snippets


//config the client client as usual
phpCAS::client(
    constant($config['cas.version']),
    $config['cas.host'],
    (int) $config['cas.port'],
    $config['cas.uri'],
    false
);

//set the attribute callback 
phpCAS::setCasAttributeParserCallback(
    array(
      new \EcasPhpCASParser\EcasPhpCASParser(),
      'parse'
    )
);


array (size=21)
  'user' => string 'gboddin' (length=7)
  'departmentNumber' => string 'xxxx' (length=13)
  'email' => string 'xxx' (length=31)
  'employeeNumber' => string 'xxx' (length=8)
  'employeeType' => string 'x' (length=1)
  'firstName' => string 'Gregory' (length=7)
  'lastName' => string 'BODDIN' (length=6)
  'domain' => string 'xxxxx' (length=12)
  'domainUsername' => string 'gboddin' (length=7)
  'telephoneNumber' => string 'xxx' (length=5)
  'locale' => string 'en' (length=2)
  'assuranceLevel' => string 'xx' (length=2)
  'uid' => string 'gboddin' (length=7)
  'orgId' => string 'xxxx' (length=6)
  'groups' => 
    array (size=18)
      0 => string 'GROUP1' (length=6)
      1 => string 'GROUP2' (length=6)
      2 => string 'GROUP3' (length=6)
      3 => string 'GROUP4' (length=6)
      4 => string 'GROUP5' (length=6)
  'strength' => string 'STRONG' (length=6)
  'loginDate' => string '2016-06-29T10:53:06.399+02:00' (length=29)
  'authenticationFactors' => 
      array (size=1)
        'password' => string 'gboddin' (length=7)
        'sms' => string 'xxxxxxx' (length=7)
  'sso' => string 'true' (length=4)
  'ticketType' => string 'SERVICE' (length=7)