forked from cztomczak/cefpython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp_authentication.php
More file actions
30 lines (21 loc) · 665 Bytes
/
http_authentication.php
File metadata and controls
30 lines (21 loc) · 665 Bytes
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
<?php
# Remember that CefRequestHandler::GetAuthCredentials() is called
# on IO thread, you need to use CefPostTask() on GUI thread to display
# a form for entering username/password.
HttpAuthentication();
function HttpAuthentication()
{
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="CEF Realm"');
header('HTTP/1.0 401 Unauthorized');
print 'The process of authentication was cancelled.';
exit();
} else {
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
print "Authenticated successfully.<br>";
print "Username=$username<br>";
print "Password=$password<br>";
}
}
?>