Before Symfony 2.8
`SimplePreAuthenticatorInterface` was in the following namespace `Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface`
It have been deprecated in 2.8 and changed in 3.0 to `Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface`

now I'm writing a bundle which must work either in symfony 2.7 and symfony 3.0 it is an api authenticator bundle for a private use.

I would like to write a factory for it which checks interface existance

example from [FosUserBundle](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/master/Controller/RegistrationController.php#L150)

```
if (interface_exists('Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface')) {
    $tokenStorage = $this->get('security.token_storage');
} else {
    $tokenStorage = $this->get('security.context');
}

```

but my class which implements this interface is a service in DI and symfony firewall directly uses this.

My question is how could I make this abstraction in a manner of best practise and logical.

AccessTokenAuthenticator Class :

```
<?php

namespace MyCompany\SBundle\Security;
// this usage for before symfony 2.8
use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface;

/**
 * Class AccessTokenAuthenticator
 */
class AccessTokenAuthenticator implements SimplePreAuthenticatorInterface
{

```

services.yml

```
# Authentication
mycompany_security.security.accesstoken_authenticator:
    class:     MyCompany\SBundle\Security\AccessTokenAuthenticator
    arguments: ["@mycompany_security.security.accesstoken_userprovider"]

```

Firewall Configuration :

```
secure_area:
    pattern:  ^/
    stateless: true
    simple_preauth:
        authenticator: mycompany_security.security.accesstoken_authenticator

```

My exact problem is even if I define two classes which are identical each other but the implementation namespace different even how could I give this to firewall ? How this can be abstracted from firewall ?

Any help would be appreciated.