1<?php 2/** 3 * Copyright 2013-2015 Horde LLC (http://www.horde.org/) 4 * 5 * See the enclosed file LICENSE for license information (BSD). If you 6 * did not receive this file, see http://www.horde.org/licenses/bsd. 7 * 8 * @author Jan Schneider <jan@horde.org> 9 * @category Horde 10 * @license http://www.horde.org/licenses/bsd BSD 11 * @package Dav 12 */ 13 14/** 15 * An authentication backend for Sabre that wraps Horde's authentication. 16 * 17 * @author Jan Schneider <jan@horde.org> 18 * @category Horde 19 * @license http://www.horde.org/licenses/bsd BSD 20 * @package Dav 21 */ 22class Horde_Dav_Auth extends Sabre\DAV\Auth\Backend\AbstractBasic 23{ 24 /** 25 * Authentication object. 26 * 27 * @var Horde_Auth_Base 28 */ 29 protected $_auth; 30 31 /** 32 * Constructor. 33 * 34 * @param Horde_Auth_Base $auth An authentication object. 35 */ 36 public function __construct(Horde_Auth_Base $auth) 37 { 38 $this->_auth = $auth; 39 } 40 41 /** 42 * Validates a username and password 43 * 44 * This method should return true or false depending on if login 45 * succeeded. 46 * 47 * @param string $username 48 * @param string $password 49 * @return bool 50 */ 51 protected function validateUserPass($username, $password) 52 { 53 return $this->_auth 54 ->authenticate($username, array('password' => $password)); 55 } 56} 57