public function searchByName($searchTerm)
 {
     if (empty($this->namsHost)) {
         throw new \Exception('NAMS host not set!', 500);
     }
     $namsUrl = "https://{$this->namsHost}/vip/services/vip_person_search.php?value={$searchTerm}";
     switch ($this->authType) {
         case 'cas':
             $response = $this->restClient->get($namsUrl);
             break;
         case 'token':
             $token = urlencode(\USF\IdM\UsfEncryption::encrypt($this->tokenData['keyValue'], time()));
             $namsUrl .= '&app=' . $this->tokenData['keyName'] . '&token=' . $token;
             $client = new \GuzzleHttp\Client();
             $response = $client->request('GET', $namsUrl);
             break;
     }
     $responseData = json_decode($response->getBody(), true);
     if ($responseData['response'] == 'success') {
         return $responseData;
     }
     return [];
 }
예제 #2
0
<?php

require_once '../vendor/autoload.php';
use USF\IdM\UsfEncryption;
//AES-256 requires a 32-character key
$key = "12345678901234561234567890123456";
$crypt = UsfEncryption::encrypt($key, "this is a test");
echo "Encrypted string: " . $crypt . "\n";
echo "Decrypted string: " . UsfEncryption::decrypt($key, $crypt);