PHP code example of fawno / ntlm-authentication

1. Go to this page and download the library: Download fawno/ntlm-authentication library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

fawno / ntlm-authentication example snippets


  use Fawno\NTLM\Authenticator\NTLMAuthenticator;
  

  // Load the authenticators. Session should be first.
  $service->loadAuthenticator('Authentication.Session');

  $service->loadAuthenticator(NTLMAuthenticator::class, [
      'domains' => [],
  ]);
  

$service->loadAuthenticator(NTLMAuthenticator::class, [
    'domains' => [
        'exampledomain' => [
            'ldap' => [
                'srv' => 'active-directory.example.com',
                'user' => base64_encode('[email protected]'),
                'pass' => base64_encode('UserPassword'),
                'dn' => 'OU=Departaments, DC=example, DC=com',
                'dn_users' => 'CN=Users, DC=example, DC=com',
            ],
            'config' => [
                'some_key' => 'some_data',
            ],
        ],
        'exampledomain2' => [
            'ldap' => [
                'srv' => 'active-directory.example2.com',
                'user' => base64_encode('[email protected]'),
                'pass' => base64_encode('UserPassword2'),
                'dn' => 'OU=Departaments, DC=example2, DC=com',
                'dn_users' => 'CN=Users, DC=example2, DC=com',
            ],
            'config' => [
                'some_key' => 'some_data',
            ],
        ],
    ],
]);