小编Max*_*tey的帖子

NTLM身份验证 - 使用PHP获取Windows登录,域和主机

我正在开发一个单点登录(SSO)PHP应用程序.
用户登录他们的Windows会话,他们希望使用他们的Windows帐户(与LDAP Active Directory连接)自动登录应用程序.

我试过这个脚本:

<?php
$headers = apache_request_headers();    // Récupération des l'entêtes client

if (@$_SERVER['HTTP_VIA'] != NULL){ // nous verifions si un proxy est utilisé : parceque l'identification par ntlm ne peut pas passer par un proxy
    echo "Proxy bypass!";
} elseif(!isset($headers['Authorization'])) {           //si l'entete autorisation est inexistante
    header( "HTTP/1.0 401 Unauthorized" );          //envoi au client le mode d'identification
    header( "WWW-Authenticate: NTLM" );         //dans notre cas le NTLM
    exit;                           //on quitte

}

if(isset($headers['Authorization']))                //dans le cas d'une authorisation (identification) …
Run Code Online (Sandbox Code Playgroud)

php apache ntlm login windows-server

16
推荐指数
1
解决办法
1万
查看次数

标签 统计

apache ×1

login ×1

ntlm ×1

php ×1

windows-server ×1