ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Basic.php
Go to the documentation of this file.
1<?php
2
3namespace Sabre\HTTP\Auth;
4
18class Basic extends AbstractAuth {
19
28 function getCredentials() {
29
30 $auth = $this->request->getHeader('Authorization');
31
32 if (!$auth) {
33 return null;
34 }
35
36 if (strtolower(substr($auth, 0, 6)) !== 'basic ') {
37 return null;
38 }
39
40 $credentials = explode(':', base64_decode(substr($auth, 6)), 2);
41
42 if (2 !== count($credentials)) {
43 return null;
44 }
45
46 return $credentials;
47
48 }
49
56 function requireLogin() {
57
58 $this->response->addHeader('WWW-Authenticate', 'Basic realm="' . $this->realm . '", charset="UTF-8"');
59 $this->response->setStatus(401);
60
61 }
62
63}
An exception for terminatinating execution or to throw for unit testing.
HTTP Authentication base class.
HTTP Basic authentication utility.
Definition: Basic.php:18
requireLogin()
This method sends the needed HTTP header and statuscode (401) to force the user to login.
Definition: Basic.php:56
getCredentials()
This method returns a numeric array with a username and password as the only elements.
Definition: Basic.php:28
$auth
Definition: fileserver.php:48