1<?php
2/*
3 * $Id: WebAuth.php 470 2012-10-24 21:43:25Z imooreyahoo@gmail.com $
4 */
5
6class phpvbAuthWebAuth implements phpvbAuth {
7
8	var $capabilities = array(
9			'canChangePassword' => false,
10			'canLogout' => false
11		);
12
13	var $config = array(
14		'serverUserKey' => 'REMOTE_USER'
15	);
16
17	function phpvbAuthWebAuth($userConfig = null) {
18		if($userConfig) $this->config = array_merge($this->config,$userConfig);
19	}
20
21	function login($username, $password)
22	{
23	}
24
25	function autoLoginHook()
26	{
27		global $_SESSION;
28		// WebAuth passthrough
29		if ( isset($_SERVER[$this->config['serverUserKey']]) )
30		{
31			$_SESSION['valid'] = true;
32			$_SESSION['user'] = $_SERVER[$this->config['serverUserKey']];
33			$_SESSION['admin'] = (!$this->config['adminUser']) || ($_SESSION['user'] == $this->config['adminUser']);
34			$_SESSION['authCheckHeartbeat'] = time();
35		}
36	}
37
38	function heartbeat($vbox)
39	{
40		global $_SESSION;
41		if ( isset($_SERVER[$this->config['serverUserKey']]) )
42		{
43			$_SESSION['valid'] = true;
44			$_SESSION['authCheckHeartbeat'] = time();
45		}
46	}
47
48	function changePassword($old, $new)
49	{
50	}
51
52	function logout(&$response)
53	{
54		$response['data']['result'] = 1;
55		if ( isset($this->config['logoutURL']) )
56		{
57			$response['data']['url'] = $this->config['logoutURL'];
58		}
59	}
60
61	function listUsers()
62	{
63
64	}
65
66	function updateUser($vboxRequest, $skipExistCheck)
67	{
68
69	}
70
71	function deleteUser($user)
72	{
73
74	}
75}
76