| 579 |
mathias |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
require "AuthPartner.php";
|
|
|
4 |
|
|
|
5 |
/**
|
|
|
6 |
* Permet de se connecter à l'annuaire de Tela Botanica à l'aide d'un compte Pl@ntNet / identify
|
|
|
7 |
*/
|
|
|
8 |
class AuthPartnerPlantnet extends AuthPartner {
|
|
|
9 |
|
|
|
10 |
public function verifierAcces($login, $password) {
|
|
|
11 |
$url = "http://identify-test.plantnet-project.org/api/security/token/create?_username=$login&_password=$password";
|
|
|
12 |
|
|
|
13 |
$curl = curl_init();
|
|
|
14 |
curl_setopt($curl, CURLOPT_URL, $url);
|
|
|
15 |
curl_setopt($curl, CURLOPT_POST, true);
|
|
|
16 |
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
|
|
17 |
$res = curl_exec($curl);
|
|
|
18 |
curl_close($curl);
|
|
|
19 |
|
|
|
20 |
$res = json_decode($res, true);
|
|
|
21 |
//var_dump($res);
|
|
|
22 |
if (!empty($res['JWT'])) {
|
|
|
23 |
$jeton = $this->lib->decoderJetonManuellement($res['JWT']);
|
|
|
24 |
// stockage pour traitement dans les autres méthodes
|
|
|
25 |
$this->data = $jeton;
|
|
|
26 |
//var_dump($jeton);
|
|
|
27 |
if (!empty($jeton['details']['email'])) {
|
|
|
28 |
//var_dump($jeton['details']['email']);
|
|
|
29 |
return true;
|
|
|
30 |
}
|
|
|
31 |
}
|
|
|
32 |
|
|
|
33 |
return false;
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
public function getIdentiteParCourriel() {
|
|
|
37 |
|
|
|
38 |
echo "get identité par courriel<br/>";
|
|
|
39 |
}
|
|
|
40 |
|
|
|
41 |
public function formaterNomWiki() {
|
|
|
42 |
|
|
|
43 |
echo "formater nom wiki<br/>";
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
public function getDateDerniereModifProfil() {
|
|
|
47 |
|
|
|
48 |
echo "get date dernière modif profil<br/>";
|
|
|
49 |
}
|
|
|
50 |
}
|