sivin / ntlm-http-auth
Extension for Nette Framework: NTLM authenticate for authenticator
2.0.0
2020-10-27 08:20 UTC
Requires
- php: >=7.1
- nette/application: ^3.0.6
- nette/di: ^3.0
- nette/http: ^3.0
- nette/security: ^3.0
This package is auto-updated.
Last update: 2024-11-27 17:25:55 UTC
README
NtlmHttpAuth
- Install via composer
composer require sivin/ntlm-http-auth
- Register extension in
config.neon
:
extensions: ntlmHttpAuth: SiViN\NtlmHttpAuth\DI\NtlmHttpAuthExtension
3, Tell which presenters should not be secured (in case no presenter name given, all presenters are secured). Format - Module:Presenter
:
ntlmHttpAuth: excludedPresenters: [Front:Nonsecured] # Exlude presenter class App\FrontModule\Presenters\NonsecuredPresenter
4, Implement SiViN\NtlmHttpAuth\INtlmAuthenticator
to your authenticator
Inconfig.neon
:
services:
authenticator: NtlmAuthenticator
File NtlmAuthenticator.php
:
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); } } }