Welcome to mirror list, hosted at ThFree Co, Russian Federation.

user_persona.php « user_persona - github.com/nextcloud/apps.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4004ad24a73ae2cfc2c601a25f28fcd026de14a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

/**
 * ownCloud - Persona plugin
 * 
 * @author Victor Dubiniuk
 * @copyright 2012-2013 Victor Dubiniuk victor.dubiniuk@gmail.com
 * 
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 */

class OC_USER_PERSONA extends OC_User_Backend {

	protected $_isPersonaRequest;

	public function __construct() {
		$this->_isPersonaRequest = @$_POST['authService'] == 'MozillaPersona';
	}

	public function createUser($uid, $password) {
		//We can't create user
		return false;
	}

	public function deleteUser($uid) {
		//We can't delete user
		return false;
	}

	public function setPassword($uid, $password) {
		// We can't change user password
		return false;
	}

	public function checkPassword($uid, $assertion) {
		if ($this->_isPersonaRequest) {
			$email = OCA\User_persona\Validator::Validate($assertion);
			if ($email) {
				return OCA\User_persona\Policy::apply($email, $uid);
			}
			
			//we've got incorrect assertion
			OCP\Util::writeLog('OC_USER_PERSONA', 'Validation failed. Incorrect Assertion.', OCP\Util::DEBUG);
			OCP\JSON::error(array('msg'=>'Incorrect Assertion'));
			exit();
		}
		
		return false;
	}

	public function userExists($uid) {
		// We dunno
		return false;
	}

	public function getUsers($search = '', $limit = null, $offset = null){
		// We don't support user listing
		return array();
	}
}