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