Created
March 27, 2013 16:55
-
-
Save nicholasbarnaby/5255972 to your computer and use it in GitHub Desktop.
php kerberos authentication - requires server to have kerberos, apache, php (extends ldap add support for active directory for basic lamp stack)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (!isset($_SERVER['PHP_AUTH_USER']) || strcmp($_SERVER['PHP_AUTH_USER'] , "logout" ) == 0 ){ | |
header('WWW-Authenticate: Basic realm="My Realm"'); | |
header('HTTP/1.0 401 Unauthorized'); | |
$username = $_SERVER['PHP_AUTH_USER']; | |
echo "{ \"username\": \"" .$username . "\" }"; | |
exit; | |
} else { | |
$username = $_SERVER['PHP_AUTH_USER']; | |
echo "{ \"username\": \"" .$username . "\" }"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment