Modif gestion d'erreur
This commit is contained in:
parent
75ff12b7b6
commit
81cbe98dfc
@ -0,0 +1,122 @@
|
||||
<?php
|
||||
class Achatclient_InextensoController extends Zend_Controller_Action
|
||||
{
|
||||
protected $theme;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function init()
|
||||
{
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Page d'accueil et de redirection
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
$testidentities=array(
|
||||
'valide de test' => array(
|
||||
'partner' => "inextenso",
|
||||
'user' => "jpdurail.demo@gmail.com",
|
||||
'mail' => "jpdurail.demo@gmail.com",
|
||||
'name' => "RICOIS",
|
||||
'lastname' => "Michael",
|
||||
),
|
||||
'mcdo' => array(
|
||||
'partner' => "inextenso",
|
||||
'user' => "test20170227091241@intescia.com",
|
||||
'mail' => "test20170227091241@intescia.com",
|
||||
'name' => "DELBOS",
|
||||
'lastname' => "Claire",
|
||||
),
|
||||
'nouveau de test' => array(
|
||||
'partner' => "inextenso",
|
||||
'user' => "test".Date("YmdHis")."@intescia.com",
|
||||
'mail' => "test".Date("YmdHis")."@intescia.com",
|
||||
'name' => "DELBOS",
|
||||
'lastname' => "Claire",
|
||||
),
|
||||
'invalide de test' => array(
|
||||
'partner' => "inextenso2",
|
||||
'user' => "invalide.demo@gmail.com",
|
||||
'mail' => "invalide.demo@gmail.com",
|
||||
'name' => "VILAIN",
|
||||
'lastname' => "Claire",
|
||||
),
|
||||
);
|
||||
$identity=$testidentities['nouveau de test'];
|
||||
$mytime = time();
|
||||
$key = 'rh5s4z';
|
||||
$data = $identity['mail'] . '/' . $mytime . '/' . $key;
|
||||
$token = hash('sha256', $data);
|
||||
//$token=base64_encode(hash_hmac('sha256',$data));
|
||||
$url2='http://extranet.sd.dev/sso/inextenso';
|
||||
$url='http://extranet.sd.dev/auth?partner=inextenso';
|
||||
echo '
|
||||
</head>
|
||||
<body onload="document.ssoForm.submit();">
|
||||
<form id="ssoForm" name="ssoForm" method="GET" action="'.$url.'" target="_blank">
|
||||
<?php ?>
|
||||
partner : <input type="text" name="partner" value="'.$identity['partner'].'"><br>
|
||||
mail : <input type="text" name="mail" value="'.$identity['mail'].'"><br>
|
||||
name : <input type="text" name="name" value="'.$identity['name'].'"><br>
|
||||
lastname : <input type="text" name="lastname" value="'.$identity['lastname'].'"><br>
|
||||
codeclient : <input type="text" name="codeclient" value=195><br>
|
||||
token : <input type="text" name="token" value="'.$token.'" size="150"><br>
|
||||
time : <input type="text" name="time" value="'.$mytime.'">'.Date('Y-m-d H:i:s',$mytime).'<br>
|
||||
Si vous n\'êtes pas automatiquement redirigé vers le service, cliquez sur ce bouton :
|
||||
<a target="_blank" href="http://extranet.sd.dev/sso/inextenso?mail='.$identity['mail'].'&name='.$identity['name'].'&lastname='.$identity['lastname'].'&token='.$token.'&time='.$mytime.'">Ouvrir</a>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
$login = $identity['mail'];
|
||||
$name = $identity['name'];
|
||||
$lastname = $identity['lastname'];
|
||||
$time = $mytime;
|
||||
|
||||
/*
|
||||
$login = 'jpdurail.demo@gmail .com';
|
||||
$name = 'Jean Paul';
|
||||
$lastname = 'DURAIL';
|
||||
$time = '1434629722';
|
||||
*/
|
||||
|
||||
$key = 'rh5s4z';
|
||||
$data = $login . '/' . $time . '/' . $key;
|
||||
$token = hash('sha256', $data);
|
||||
|
||||
echo "Lien : <a target=\"_blank\" href=\"http://extranet.sd.dev/sso/inextenso?mail=".$login."&name=".$name."&lastname=".$lastname."&token=".$token."&time=".$time."\">Ouvrir</a>";
|
||||
echo "<br/>";
|
||||
echo "SHA256 : ".$token;
|
||||
echo "<br/>";
|
||||
echo "TOKEN : ".base64_encode($token);
|
||||
echo "<br/>";
|
||||
echo "SHA256 HMAC : ".hash_hmac('sha256',$data,$key);
|
||||
echo "<br/>";
|
||||
echo "TOKEN : ".base64_encode(hash_hmac('sha256',$data,$key));
|
||||
echo "<br/>";
|
||||
|
||||
/*
|
||||
echo "<br/><br/>";
|
||||
$algos = hash_algos();
|
||||
foreach ($algos as $item) {
|
||||
echo $item." TOKEN : ".hash($item, $data)." - BASE64 : ".base64_encode(hash($item, $data));
|
||||
echo "<br/>";
|
||||
}
|
||||
*/
|
||||
die;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user