diff --git a/VERSIONS_HOTLINE/49992 b/VERSIONS_HOTLINE/49992
new file mode 100644
index 0000000000000000000000000000000000000000..6dd000f435c53482ab449e734bba82b4f9d8ca5f
--- /dev/null
+++ b/VERSIONS_HOTLINE/49992
@@ -0,0 +1 @@
+ - ticket #49992 : Authentification : correction de l'authentification des abonnés SIGB
\ No newline at end of file
diff --git a/library/Class/Users.php b/library/Class/Users.php
index 8a17e0f4ff06d13207616c0c07b183b54402ac99..83b837af8d4d861661528f05b582e9e940e82892 100644
--- a/library/Class/Users.php
+++ b/library/Class/Users.php
@@ -50,20 +50,20 @@ class UsersLoader extends Storm_Model_Loader {
     if (($ordreabon = $patron->getOrdreabon())
          && ($user = Class_Users::findFirstBy(['login' => $patron->getLogin(),
                                                'ordreabon' => $ordreabon,
-                                               'id_site' => $bib->getIdBib()])))
+                                               'id_site' => $bib->getId()])))
       return $user;
 
     if ($user = Class_Users::findFirstBy(['login' => $patron->getLogin(),
                                           'id_sigb' => $patron->getIdSigb(),
-                                          'id_site' => $bib->getIdBib()]))
+                                          'id_site' => $bib->getId()]))
       return $user;
 
     if ($user = Class_Users::findFirstBy(['login' => $patron->getLogin(),
-                                          'id_site' => $bib->getIdBib()]))
+                                          'id_site' => $bib->getId()]))
       return $user;
 
     if (($id_sigb = $patron->getIdSigb())
-        && ($user = Class_Users::findFirstBy(['id_site' => $bib->getIdBib(),
+        && ($user = Class_Users::findFirstBy(['id_site' => $bib->getId(),
                                               'id_sigb' => $patron->getIdSigb()])))
       return $user;
 
@@ -993,6 +993,7 @@ class Class_Users extends Storm_Model_Abstract {
       ->save();
   }
 
+
   public function ifLoginExist($login) {
     $login = (trim($login));
 
@@ -1000,10 +1001,10 @@ class Class_Users extends Storm_Model_Abstract {
     return $login ? true : false;
   }
 
-  public function ifIdSigbExist($idSigb) {
-    $idSigb = (trim($idSigb));
-    $idSigb = $this->getLoader()->findFirstBy(['id_sigb' => $idSigb]);
-    return $idSigb ? true : false;
+
+  protected function _isUnique() {
+    return 0 == $this->getLoader()->countBy(['id_sigb' => $this->getIdSigb(),
+                                             'login' => $this->getLogin()]);
   }
 
 
@@ -1015,7 +1016,7 @@ class Class_Users extends Storm_Model_Abstract {
     $this->checkAttribute('login',mb_strlen($this->getLogin(),'UTF-8') <= 50, $this->_("Le champ 'Identifiant' doit être inférieur à 50 caractères"));
 
     if ($this->isNew()) {
-      $this->checkAttribute('login',($this->ifLoginExist($this->getLogin()) && $this->ifIdSigbExist($this->getIdSigb())) == false,
+      $this->checkAttribute('login', $this->_isUnique(),
                             $this->_("L'identifiant que vous avez choisi existe déjà."));
     }
 
diff --git a/library/ZendAfi/Auth/Adapter/CommSigb.php b/library/ZendAfi/Auth/Adapter/CommSigb.php
index 3e478cbb1dce8c5118d01d1315162e08199c9870..2c415d12787f574ff78f04f8f589bcc99801aa79 100644
--- a/library/ZendAfi/Auth/Adapter/CommSigb.php
+++ b/library/ZendAfi/Auth/Adapter/CommSigb.php
@@ -23,7 +23,6 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
   protected $_identity = null;
   protected $_credential = null;
   protected $_authenticated_user = null;
-  protected $_bib = null;
 
 
   /**
@@ -51,14 +50,14 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
    */
   public function authenticate() {
     return
-      $this->authResult(
-                        $this->matchingProcessSIGBUserInDB(
-                                                           $this->getUserFromSigb(Class_Users::newInstance(['login' => $this->_identity,
-                                                                                                            'password' => $this->_credential]))));
+      $this->_authResult(
+                         $this->_matchingProcessSIGBUserInDB(
+                                                             $this->_getUserFromSigb(Class_Users::newInstance(['login' => $this->_identity,
+                                                                                                               'password' => $this->_credential]))));
   }
 
 
-  public function matchingProcessSIGBUserInDB($user_from_sigb) {
+  protected function _matchingProcessSIGBUserInDB($user_from_sigb) {
     if(!$user_from_sigb)
       return null;
 
@@ -73,21 +72,20 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
   protected function _getUserToSave($user_from_sigb) {
     $new_user = Class_Users::newInstance()->setLogin($this->_identity);
 
-    if (!$this->_bib)
+    if (!$bib = $user_from_sigb->getBib())
       return $new_user;
 
-    if ($user = Class_Users::findMatchingPatron($user_from_sigb, $this->_bib))
+    if ($user = Class_Users::findMatchingPatron($user_from_sigb, $bib))
       return $user;
 
     return $new_user;
   }
 
 
-  public function getUserFromSigb($user) {
-    $bibs = $this->getBibsToAuthenticateTo($user);
+  protected function _getUserFromSigb($user) {
+    $bibs = $this->_getBibsToAuthenticateTo($user);
 
     foreach($bibs as $bib) {
-      $this->_bib = $bib;
       if (!$emprunteur = $bib->getSIGBComm()->getEmprunteur($user))
         continue;
 
@@ -98,14 +96,18 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
         continue;
 
       $emprunteur->updateUser($user);
-      return $user->setIdSite($bib->getId());
+
+      if(!$user->hasIdSite())
+        $user->setIdSite($bib->getId());
+
+      return $user;
     }
-    $this->_bib = null;
+
     return  null;
   }
 
 
-  public function getBibsToAuthenticateTo($user) {
+  protected function _getBibsToAuthenticateTo($user) {
     $users_in_db = Class_Users::findAllBy(['login' => $user->getLogin()]);
 
     if (1 !== count($users_in_db))
@@ -119,7 +121,7 @@ class ZendAfi_Auth_Adapter_CommSigb implements Zend_Auth_Adapter_Interface {
   }
 
 
-  public function authResult($user) {
+  protected function _authResult($user) {
     $result = new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, $this->_identity);
 
     if(!$user)
diff --git a/tests/application/modules/opac/controllers/AuthControllerTest.php b/tests/application/modules/opac/controllers/AuthControllerTest.php
index eb6590d40ae4e16d09ad508796a2ff90e1451106..d547a897e94db22389f29985f1d1fee7ae4906bf 100644
--- a/tests/application/modules/opac/controllers/AuthControllerTest.php
+++ b/tests/application/modules/opac/controllers/AuthControllerTest.php
@@ -2478,7 +2478,7 @@ class AuthControllerPostWithSameIdSigbTest extends AbstractControllerTestCase {
                     'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
                     'idabon' => 'foo',
                     'id_site' => 56,
-                    'id_sigb' => null]);
+                    'id_sigb' => 789]);
 
     $this->postDispatch('/opac/auth/login',
                         ['username' => 'foo',
@@ -2496,5 +2496,78 @@ class AuthControllerPostWithSameIdSigbTest extends AbstractControllerTestCase {
   public function userFooShouldBeLogged() {
     $this->assertNotNull(Class_Users::getIdentity());
     $this->assertEquals('foo', Class_Users::getIdentity()->getLogin());
+    $this->assertEquals('5', Class_Users::getIdentity()->getId());
+  }
+}
+
+
+
+class AuthControllerPostLoginWithDifferentIdSiteTest extends AbstractControllerTestCase {
+  protected $_storm_default_to_volatile = true;
+
+  public function setUp() {
+    parent::setUp();
+
+    ZendAfi_Auth::getInstance()->clearIdentity();
+
+    $pasc_library = $this->fixture('Class_Bib',
+                                   ['id' => 987,
+                                    'libelle' => 'Pasc Library']);
+
+    $pasc = $this->fixture('Class_CodifAnnexe',
+                           ['id' => 15,
+                            'libelle' => 'pasc',
+                            'code' => 'PASC',
+                            'id_bib' => 987]);
+
+    $emprunteur = Class_WebService_SIGB_Emprunteur::newInstance(789, 'koha');
+    $emprunteur->setPassword('bar')
+               ->setLibraryCode('PASC');
+    $emprunteur->beValid();
+
+    $service = $this->mock()
+                    ->whenCalled('getEmprunteur')
+                    ->answers($emprunteur)
+
+                    ->whenCalled('isConnected')
+                    ->answers(true);
+
+    $params = ['url_serveur' => 'http://mon-koha-de-test.org',
+               'id_bib' => 56,
+               'type' => Class_IntBib::COM_KOHA];
+
+    Class_WebService_SIGB_Koha::setService($params,
+                                           $service);
+
+    $this->fixture('Class_Bib',
+                   ['id' => 56,
+                    'libelle' => 'Library']);
+
+    $this->fixture('Class_IntBib',
+                   ['id' => 56,
+                    'id_bib' => 56,
+                    'comm_sigb' => 5,
+                    'comm_params' => serialize($params)]);
+
+    $this->fixture('Class_Users',
+                   ['id' => 5,
+                    'login' => 'foo',
+                    'password' => 'bar',
+                    'role_level' => ZendAfi_Acl_AdminControllerRoles::ABONNE_SIGB,
+                    'idabon' => 'foo',
+                    'id_site' => 56,
+                    'id_sigb' => null]);
+
+    $this->postDispatch('/opac/auth/login',
+                        ['username' => 'foo',
+                         'password' => 'bar']);
+  }
+
+
+  /** @test */
+  public function userFooShouldBeLoggedAndCreated() {
+    $this->assertNotNull(Class_Users::getIdentity());
+    $this->assertEquals('foo', Class_Users::getIdentity()->getLogin());
+    $this->assertEquals('6', Class_Users::getIdentity()->getId());
   }
 }
\ No newline at end of file