final move of files
[web.mtrack] / MTrack / auth / openid.php
1 <?php # vim:ts=2:sw=2:et:
2 /* For licensing and copyright terms, see the file named LICENSE */
3 require_once 'Interface/Auth.php';
4
5 /* all the clever stuff happens in openid.php */
6 class MTrackAuth_OpenID implements IMTrackAuth, IMTrackNavigationHelper {
7   function __construct() {
8     MTrackAuth::registerMech($this);
9     MTrackNavigation::registerHelper($this);
10   }
11
12   function augmentUserInfo(&$content) {
13     global $ABSWEB;
14     if (isset($_SESSION['openid.id'])) {
15       $content .= " | <a href='{$ABSWEB}openid.php/signout'>Log off</a>";
16     } else {
17       $content = "<a href='{$ABSWEB}openid.php'>Log In</a>";
18     }
19   }
20
21   function augmentNavigation($id, &$items) {
22   }
23
24   function authenticate() {
25     if (!strlen(session_id()) && php_sapi_name() != 'cli') {
26       session_start();
27     }
28     if (isset($_SESSION['openid.id'])) {
29       if (isset($_SESSION['openid.userid'])) {
30         return $_SESSION['openid.userid'];
31       }
32       return $_SESSION['openid.id'];
33     }
34     return null;
35   }
36
37   function doAuthenticate($force = false) {
38     if ($force) {
39       global $ABSWEB;
40       header("Location: {$ABSWEB}openid.php");
41       exit;
42     }
43     return null;
44   }
45
46   function enumGroups() {
47     return null;
48   }
49
50   function getGroups($username) {
51     return null;
52   }
53
54   function addToGroup($username, $groupname) {
55     return null;
56   }
57
58   function removeFromGroup($username, $groupname) {
59     return null;
60   }
61
62   function getUserData($username) {
63     return null;
64   }
65 }
66
67