|
@@ 1785-1821 (lines=37) @@
|
| 1782 |
|
} |
| 1783 |
|
|
| 1784 |
|
$res = $provider->beginPrimaryAccountLink( $user, $reqs ); |
| 1785 |
|
switch ( $res->status ) { |
| 1786 |
|
case AuthenticationResponse::PASS; |
| 1787 |
|
$this->logger->info( "Account linked to {user} by $id", [ |
| 1788 |
|
'user' => $user->getName(), |
| 1789 |
|
] ); |
| 1790 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1791 |
|
return $res; |
| 1792 |
|
|
| 1793 |
|
case AuthenticationResponse::FAIL; |
| 1794 |
|
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
| 1795 |
|
'user' => $user->getName(), |
| 1796 |
|
] ); |
| 1797 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1798 |
|
return $res; |
| 1799 |
|
|
| 1800 |
|
case AuthenticationResponse::ABSTAIN; |
| 1801 |
|
// Continue loop |
| 1802 |
|
break; |
| 1803 |
|
|
| 1804 |
|
case AuthenticationResponse::REDIRECT; |
| 1805 |
|
case AuthenticationResponse::UI; |
| 1806 |
|
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
| 1807 |
|
'user' => $user->getName(), |
| 1808 |
|
] ); |
| 1809 |
|
$state['primary'] = $id; |
| 1810 |
|
$state['continueRequests'] = $res->neededRequests; |
| 1811 |
|
$session->setSecret( 'AuthManager::accountLinkState', $state ); |
| 1812 |
|
$session->persist(); |
| 1813 |
|
return $res; |
| 1814 |
|
|
| 1815 |
|
// @codeCoverageIgnoreStart |
| 1816 |
|
default: |
| 1817 |
|
throw new \DomainException( |
| 1818 |
|
get_class( $provider ) . "::beginPrimaryAccountLink() returned $res->status" |
| 1819 |
|
); |
| 1820 |
|
// @codeCoverageIgnoreEnd |
| 1821 |
|
} |
| 1822 |
|
} |
| 1823 |
|
|
| 1824 |
|
$this->logger->debug( __METHOD__ . ': Account linking failed because no provider accepted', [ |
|
@@ 1891-1918 (lines=28) @@
|
| 1888 |
|
} |
| 1889 |
|
$id = $provider->getUniqueId(); |
| 1890 |
|
$res = $provider->continuePrimaryAccountLink( $user, $reqs ); |
| 1891 |
|
switch ( $res->status ) { |
| 1892 |
|
case AuthenticationResponse::PASS; |
| 1893 |
|
$this->logger->info( "Account linked to {user} by $id", [ |
| 1894 |
|
'user' => $user->getName(), |
| 1895 |
|
] ); |
| 1896 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1897 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1898 |
|
return $res; |
| 1899 |
|
case AuthenticationResponse::FAIL; |
| 1900 |
|
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
| 1901 |
|
'user' => $user->getName(), |
| 1902 |
|
] ); |
| 1903 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1904 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1905 |
|
return $res; |
| 1906 |
|
case AuthenticationResponse::REDIRECT; |
| 1907 |
|
case AuthenticationResponse::UI; |
| 1908 |
|
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
| 1909 |
|
'user' => $user->getName(), |
| 1910 |
|
] ); |
| 1911 |
|
$state['continueRequests'] = $res->neededRequests; |
| 1912 |
|
$session->setSecret( 'AuthManager::accountLinkState', $state ); |
| 1913 |
|
return $res; |
| 1914 |
|
default: |
| 1915 |
|
throw new \DomainException( |
| 1916 |
|
get_class( $provider ) . "::continuePrimaryAccountLink() returned $res->status" |
| 1917 |
|
); |
| 1918 |
|
} |
| 1919 |
|
} catch ( \Exception $ex ) { |
| 1920 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1921 |
|
throw $ex; |