f1cfda4ea71f0e9a406c7b2daaea0e02521ee208
[lhc/web/www.git] / www / ecrire / action / auth.php
1 <?php
2
3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
5 * *
6 * Copyright (c) 2001-2017 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
8 * *
9 * Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
10 * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. *
11 \***************************************************************************/
12
13 /**
14 * Gestion de l'action auth
15 *
16 * @package SPIP\Core\Authentification
17 **/
18
19 if (!defined('_ECRIRE_INC_VERSION')) {
20 return;
21 }
22
23 /**
24 * Retour d'authentification pour les SSO
25 */
26 function action_auth_dist() {
27
28 $securiser_action = charger_fonction('securiser_action', 'inc');
29 $arg = $securiser_action();
30
31 if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) {
32 spip_log("action_auth_dist $arg pas compris");
33 } else {
34 $auth_methode = $r[1];
35 $login = $r[2];
36 include_spip('inc/auth');
37 $res = auth_terminer_identifier_login($auth_methode, $login);
38
39 if (is_string($res)) { // Erreur
40 $redirect = _request('redirect');
41 $redirect = parametre_url($redirect, 'var_erreur', $res, '&');
42 include_spip('inc/headers');
43 redirige_par_entete($redirect);
44 }
45
46 // sinon on loge l'auteur identifie, et on finit (redirection automatique)
47 auth_loger($res);
48 }
49 }