Esempio n. 1
0
 public function test()
 {
     $token = new Token('inao', 'archives', ['group1' => 'right1']);
     $ednaoCrypt = new EdnaoCryptography();
     $tokenManager = new TokenManager($ednaoCrypt);
     $crypt = $tokenManager->getTokenCrypt($token);
     $uncryptToken = $tokenManager->getTokenDecrypt($crypt);
     $this->assertEquals($token->serialize(), $uncryptToken->serialize());
 }
Esempio n. 2
0
 public static function iframe($baseUrl, $socle, $version, $product, array $rights, $page)
 {
     $token = new Token($socle, $product, $rights);
     $ednaoCrypt = new EdnaoCryptography();
     $ednaoCrypt->setPublicKey(file_get_contents(__DIR__ . '/../../var/auth/public.pem'));
     $tokenManager = new TokenManager($ednaoCrypt);
     $encodedToken = $tokenManager->getTokenCrypt($token);
     $loginUrl = sprintf('/naoned/%s/%s/%s', $encodedToken, urlencode($version), urlencode($page));
     return sprintf('<iframe
         src=""
         frameborder="1" marginheight="0" marginwidth="0"
         width="400" height="600"
         id="ednao"
         data-login-path="%s"
         data-base-url="%s"
         data-context-path="%s"
         style="%s"
         >
         <p>Votre navigateur ne supporte pas l’élément iframe,
           l’aide ne peut donc pas être affichée</p>
         </iframe>', $loginUrl, $baseUrl, self::CONTEXT_PATH, self::style());
 }