|
@@ 1770-1807 (lines=38) @@
|
| 1767 |
|
} |
| 1768 |
|
|
| 1769 |
|
$res = $provider->beginPrimaryAccountLink( $user, $reqs ); |
| 1770 |
|
switch ( $res->status ) { |
| 1771 |
|
case AuthenticationResponse::PASS; |
| 1772 |
|
$this->logger->info( "Account linked to {user} by $id", [ |
| 1773 |
|
'user' => $user->getName(), |
| 1774 |
|
] ); |
| 1775 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1776 |
|
return $res; |
| 1777 |
|
|
| 1778 |
|
case AuthenticationResponse::FAIL; |
| 1779 |
|
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
| 1780 |
|
'user' => $user->getName(), |
| 1781 |
|
] ); |
| 1782 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1783 |
|
return $res; |
| 1784 |
|
|
| 1785 |
|
case AuthenticationResponse::ABSTAIN; |
| 1786 |
|
// Continue loop |
| 1787 |
|
break; |
| 1788 |
|
|
| 1789 |
|
case AuthenticationResponse::REDIRECT; |
| 1790 |
|
case AuthenticationResponse::UI; |
| 1791 |
|
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
| 1792 |
|
'user' => $user->getName(), |
| 1793 |
|
] ); |
| 1794 |
|
$this->fillRequests( $res->neededRequests, self::ACTION_LINK, $user->getName() ); |
| 1795 |
|
$state['primary'] = $id; |
| 1796 |
|
$state['continueRequests'] = $res->neededRequests; |
| 1797 |
|
$session->setSecret( 'AuthManager::accountLinkState', $state ); |
| 1798 |
|
$session->persist(); |
| 1799 |
|
return $res; |
| 1800 |
|
|
| 1801 |
|
// @codeCoverageIgnoreStart |
| 1802 |
|
default: |
| 1803 |
|
throw new \DomainException( |
| 1804 |
|
get_class( $provider ) . "::beginPrimaryAccountLink() returned $res->status" |
| 1805 |
|
); |
| 1806 |
|
// @codeCoverageIgnoreEnd |
| 1807 |
|
} |
| 1808 |
|
} |
| 1809 |
|
|
| 1810 |
|
$this->logger->debug( __METHOD__ . ': Account linking failed because no provider accepted', [ |
|
@@ 1877-1905 (lines=29) @@
|
| 1874 |
|
} |
| 1875 |
|
$id = $provider->getUniqueId(); |
| 1876 |
|
$res = $provider->continuePrimaryAccountLink( $user, $reqs ); |
| 1877 |
|
switch ( $res->status ) { |
| 1878 |
|
case AuthenticationResponse::PASS; |
| 1879 |
|
$this->logger->info( "Account linked to {user} by $id", [ |
| 1880 |
|
'user' => $user->getName(), |
| 1881 |
|
] ); |
| 1882 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1883 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1884 |
|
return $res; |
| 1885 |
|
case AuthenticationResponse::FAIL; |
| 1886 |
|
$this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
| 1887 |
|
'user' => $user->getName(), |
| 1888 |
|
] ); |
| 1889 |
|
$this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
| 1890 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1891 |
|
return $res; |
| 1892 |
|
case AuthenticationResponse::REDIRECT; |
| 1893 |
|
case AuthenticationResponse::UI; |
| 1894 |
|
$this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
| 1895 |
|
'user' => $user->getName(), |
| 1896 |
|
] ); |
| 1897 |
|
$this->fillRequests( $res->neededRequests, self::ACTION_LINK, $user->getName() ); |
| 1898 |
|
$state['continueRequests'] = $res->neededRequests; |
| 1899 |
|
$session->setSecret( 'AuthManager::accountLinkState', $state ); |
| 1900 |
|
return $res; |
| 1901 |
|
default: |
| 1902 |
|
throw new \DomainException( |
| 1903 |
|
get_class( $provider ) . "::continuePrimaryAccountLink() returned $res->status" |
| 1904 |
|
); |
| 1905 |
|
} |
| 1906 |
|
} catch ( \Exception $ex ) { |
| 1907 |
|
$session->remove( 'AuthManager::accountLinkState' ); |
| 1908 |
|
throw $ex; |