Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| tao_models_classes_HttpDigestAuthAdapter | |
0.00% |
0 / 11 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
| __construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| authenticate | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; under version 2 |
| 7 | * of the License (non-upgradable). |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 17 | * |
| 18 | * Copyright (c) 2013 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT); |
| 19 | * |
| 20 | * |
| 21 | */ |
| 22 | |
| 23 | /** |
| 24 | * HTTP Authentication implementation of RFC 2617 (http://tools.ietf.org/html/rfc2617) |
| 25 | * |
| 26 | * @access public |
| 27 | * @author Joel Bout, <joel@taotesting.com> |
| 28 | * @package tao |
| 29 | |
| 30 | */ |
| 31 | class tao_models_classes_HttpDigestAuthAdapter implements common_user_auth_Adapter |
| 32 | { |
| 33 | /** |
| 34 | * |
| 35 | * @var common_http_Request |
| 36 | */ |
| 37 | private $request; |
| 38 | |
| 39 | /** |
| 40 | * Creates an Authentication adapter from an OAuth Request |
| 41 | * |
| 42 | * @param common_http_Request $request |
| 43 | */ |
| 44 | public function __construct(common_http_Request $request) |
| 45 | { |
| 46 | $this->request = $request; |
| 47 | } |
| 48 | |
| 49 | /** |
| 50 | * (non-PHPdoc) |
| 51 | * @see common_user_auth_Adapter::authenticate() |
| 52 | */ |
| 53 | public function authenticate() |
| 54 | { |
| 55 | |
| 56 | throw new common_exception_NotImplemented(); |
| 57 | |
| 58 | $digest = tao_helpers_Http::getDigest(); |
| 59 | $data = tao_helpers_Http::parseDigest($digest); |
| 60 | //store the hash A1 as a property to be updated on register/changepassword |
| 61 | $trialLogin = 'admin'; |
| 62 | $trialPassword = 'admin'; |
| 63 | $A1 = md5($trialLogin . ':' . $this::realm . ':' . $trialPassword); |
| 64 | $A2 = md5($_SERVER['REQUEST_METHOD'] . ':' . $data['uri']); |
| 65 | $valid_response = md5( |
| 66 | $A1 . ':' . $data['nonce'] . ':' . $data['nc'] . ':' . $data['cnonce'] . ':' . $data['qop'] . ':' . $A2 |
| 67 | ); |
| 68 | } |
| 69 | } |