261 |
gduche |
1 |
<?php
|
262 |
gduche |
2 |
//Inclusion du framework
|
|
|
3 |
require '../../framework/Framework.php';
|
261 |
gduche |
4 |
|
|
|
5 |
// Ajout d'information concernant cette application
|
|
|
6 |
Framework::setCheminAppli(__FILE__);// Obligatoire
|
|
|
7 |
Framework::setInfoAppli(Config::get('info'));// Optionnel
|
|
|
8 |
|
|
|
9 |
$status = "";
|
|
|
10 |
|
|
|
11 |
if (isset($_POST['openid_action']) &&
|
|
|
12 |
$_POST['openid_action'] == "login" &&
|
|
|
13 |
!empty($_POST['openid_identifier'])) {
|
|
|
14 |
|
|
|
15 |
$consumer = new OpenIdClient();
|
|
|
16 |
if (!$consumer->login($_POST['openid_identifier'])) {
|
|
|
17 |
$status = "OpenID login failed.";
|
|
|
18 |
}
|
|
|
19 |
} else if (isset($_GET['openid_mode'])) {
|
|
|
20 |
if ($_GET['openid_mode'] == "id_res") {
|
|
|
21 |
$consumer = new OpenIdClient();
|
|
|
22 |
if ($consumer->verify($_GET, $id)) {
|
|
|
23 |
$status = "VALID " . htmlspecialchars($id);
|
|
|
24 |
} else {
|
|
|
25 |
$status = "INVALID " . htmlspecialchars($id);
|
|
|
26 |
}
|
|
|
27 |
} else if ($_GET['openid_mode'] == "cancel") {
|
|
|
28 |
$status = "CANCELLED";
|
|
|
29 |
}
|
|
|
30 |
}
|
|
|
31 |
?>
|
|
|
32 |
|
|
|
33 |
<!DOCTYPE html>
|
|
|
34 |
<html lang="fr">
|
|
|
35 |
<head>
|
|
|
36 |
<meta charset="UTF-8">
|
|
|
37 |
<meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
|
|
|
38 |
<title>Client Open Id de Tela Botanica - Identification</title>
|
|
|
39 |
<meta name="DC.title" content="Client Open Id de Tela Botanica - Identification" />
|
|
|
40 |
<meta name="description" content="Client de l'application Open Id de Tela Botanica, Identification unique" />
|
|
|
41 |
<meta name="keywords" content="OpenId, identification automatique, Tela Botanica" />
|
|
|
42 |
<meta name="author" content="Grégoire Duché" />
|
|
|
43 |
</head>
|
|
|
44 |
<body>
|
|
|
45 |
<h1>Identification par OpenId</h1>
|
|
|
46 |
<?php echo "$status<br>" ?>
|
|
|
47 |
<p>Veuillez saisir les informations de connexion ci-dessous : </p>
|
|
|
48 |
<!-- TODO : ajouter action="" -->
|
|
|
49 |
<form name="identication" method="post">
|
|
|
50 |
<input type="text" name="openid_identifier">
|
|
|
51 |
<input type="submit" name="openid_action" value="login">
|
|
|
52 |
</form>
|
|
|
53 |
</body>
|
|
|
54 |
</html>
|