PHP code example of sivin / ntlm-http-auth

1. Go to this page and download the library: Download sivin/ntlm-http-auth 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/ */

    

sivin / ntlm-http-auth example snippets


extensions:
	ntlmHttpAuth: SiViN\NtlmHttpAuth\DI\NtlmHttpAuthExtension

ntlmHttpAuth:
	excludedPresenters: [Front:Nonsecured] # Exlude presenter class App\FrontModule\Presenters\NonsecuredPresenter

services:
	authenticator: NtlmAuthenticator

class NtlmAuthenticator implements \Nette\Security\IAuthenticator, \SiViN\NtlmHttpAuth\INtlmAuthenticator
{
    function authenticate(array $credentials)
    {
        ...
    }

    function ntlmAuthenticate(\SiViN\NtlmHttpAuth\AuthenticateResult $authenticateResult)
    {
        if($this->LdapOrDbOrSomething($authenticateResult->username, $authenticateResult->domain, $authenticateResult->workstation))
        {
            return new \Nette\Security\Identity(...);
        }
        else
        {
            throw new \Nette\Security\AuthenticationException('User not found', self::IDENTITY_NOT_FOUND);
        }
    }
}