# Laminas Authentication login TTL/persistence

**URL:** <https://discourse.laminas.dev/t/laminas-authentication-login-ttl-persistence/3881>\
**Category:** Components & MVC\
**Tags:** laminas-authentication\
**Created:** [March 28, 2025, 11:51am UTC](https://discourse.laminas.dev/t/laminas-authentication-login-ttl-persistence/3881 "2025-03-28T11:51:15Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![Tyrsson](https://yyz2.discourse-cdn.com/flex032/user_avatar/discourse.laminas.dev/tyrsson/32/1664_2.png) [@Tyrsson](https://discourse.laminas.dev/u/Tyrsson)\
**Post date:** [March 31, 2025, 5:47pm UTC](https://discourse.laminas.dev/t/laminas-authentication-login-ttl-persistence/3881/8 "2025-03-31T17:47:44Z")

</div>

That is the factory for your controller. We need to see the factory for the AuthenticationService. In this factory you are setting up the adapter, which should be handled in the AuthenticationService factory (usually).

How are you checking to see if the identity is still authenticated?

Do you have laminas-di installed in this project?

If there was an AuthenticationService factory present I would expect to see something like this in your controller factory.

```auto
$auth = $container->get(AuthenticationService::class);

```

You need a factory for the AuthenticationService just like you need a factory for the controller.

Here is a link to a factory for the AuthenticationService from a couple years back where @froschdesign helped me with a related issue regarding the AuthenticationService.

> [@Unable to resolve service error](https://discourse.laminas.dev/t/unable-to-resolve-service-error/2986/14):
>
> Here is an example for the factory: namespace User\Authentication; use Laminas\Authentication\Adapter\DbTable\CallbackCheckAdapter; use Laminas\Authentication\AuthenticationService; use Laminas\Db\Adapter\Adapter; use Laminas\Db\Adapter\AdapterInterface; use Psr\Container\ContainerInterface; use Webmozart\Assert\Assert; final class AuthenticationServiceFactory { public function \_\_invoke( ContainerInterface $container ): AuthenticationService { $databaseAdapter = $conta…

---

_[View the full topic](https://discourse.laminas.dev/t/laminas-authentication-login-ttl-persistence/3881)._
