PHPackages                             adt/doctrine-authenticator - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. adt/doctrine-authenticator

ActiveLibrary[Database &amp; ORM](/categories/database)

adt/doctrine-authenticator
==========================

A Doctrine authenticator for Nette framework.

v2.6.0(1mo ago)116.9k↓36.8%11MITPHPPHP &gt;=8.4

Since Jun 21Pushed 2mo ago4 watchersCompare

[ Source](https://github.com/AppsDevTeam/doctrine-authenticator)[ Packagist](https://packagist.org/packages/adt/doctrine-authenticator)[ RSS](/packages/adt-doctrine-authenticator/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (50)Used By (1)

Doctrine Authenticator
======================

[](#doctrine-authenticator)

- Allows you to use a Doctrine entity as a Nette identity
- Uses cookies instead of PHP sessions
- Saves IP address and User-Agent header for better abuse detection
- Detects an invalid token and call onInvalidToken callback to log and prevent possible abuse
- Invalidates token on different User-Agent header and IP address when fraudDetection is enabled and call onFraudDetection callback to log and prevent possible abuse

Install
-------

[](#install)

```
composer require adt/doctrine-authenticator

```

Configuration
-------------

[](#configuration)

### 1) Neon configuration

[](#1-neon-configuration)

```
services:
	security.user: App\Model\Security\SecurityUser
	security.userStorage: Nette\Bridges\SecurityHttp\CookieStorage
	security.authenticator:
		factory: App\Model\Security\Authenticator(expiration: '14 days')
		setup:
			- setFraudDetection(true) # you can disable it for automatic tests for example

```

Add new mapping via attributes like this (if you are using nettrine):

```
nettrine.orm.attributes:
	mapping:
		ADT\DoctrineAuthenticator: %appDir%/../vendor/adt/doctrine-authenticator/src

```

or via annotations:

```
nettrine.orm.annotations:
	mapping:
		ADT\DoctrineAuthenticator: %appDir%/../vendor/adt/doctrine-authenticator/src

```

### 2) Create a Identity entity implementing ADT\\DoctrineAuthenticator\\DoctrineAuthenticatorIdentity

[](#2-create-a-identity-entity-implementing-adtdoctrineauthenticatordoctrineauthenticatoridentity)

and adjust to your needs.

```
