@@ 1838-1875 (lines=38) @@ | ||
1835 | } |
|
1836 | ||
1837 | $res = $provider->beginPrimaryAccountLink( $user, $reqs ); |
|
1838 | switch ( $res->status ) { |
|
1839 | case AuthenticationResponse::PASS; |
|
1840 | $this->logger->info( "Account linked to {user} by $id", [ |
|
1841 | 'user' => $user->getName(), |
|
1842 | ] ); |
|
1843 | $this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
|
1844 | return $res; |
|
1845 | ||
1846 | case AuthenticationResponse::FAIL; |
|
1847 | $this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
|
1848 | 'user' => $user->getName(), |
|
1849 | ] ); |
|
1850 | $this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
|
1851 | return $res; |
|
1852 | ||
1853 | case AuthenticationResponse::ABSTAIN; |
|
1854 | // Continue loop |
|
1855 | break; |
|
1856 | ||
1857 | case AuthenticationResponse::REDIRECT; |
|
1858 | case AuthenticationResponse::UI; |
|
1859 | $this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
|
1860 | 'user' => $user->getName(), |
|
1861 | ] ); |
|
1862 | $this->fillRequests( $res->neededRequests, self::ACTION_LINK, $user->getName() ); |
|
1863 | $state['primary'] = $id; |
|
1864 | $state['continueRequests'] = $res->neededRequests; |
|
1865 | $session->setSecret( 'AuthManager::accountLinkState', $state ); |
|
1866 | $session->persist(); |
|
1867 | return $res; |
|
1868 | ||
1869 | // @codeCoverageIgnoreStart |
|
1870 | default: |
|
1871 | throw new \DomainException( |
|
1872 | get_class( $provider ) . "::beginPrimaryAccountLink() returned $res->status" |
|
1873 | ); |
|
1874 | // @codeCoverageIgnoreEnd |
|
1875 | } |
|
1876 | } |
|
1877 | ||
1878 | $this->logger->debug( __METHOD__ . ': Account linking failed because no provider accepted', [ |
|
@@ 1945-1973 (lines=29) @@ | ||
1942 | } |
|
1943 | $id = $provider->getUniqueId(); |
|
1944 | $res = $provider->continuePrimaryAccountLink( $user, $reqs ); |
|
1945 | switch ( $res->status ) { |
|
1946 | case AuthenticationResponse::PASS; |
|
1947 | $this->logger->info( "Account linked to {user} by $id", [ |
|
1948 | 'user' => $user->getName(), |
|
1949 | ] ); |
|
1950 | $this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
|
1951 | $session->remove( 'AuthManager::accountLinkState' ); |
|
1952 | return $res; |
|
1953 | case AuthenticationResponse::FAIL; |
|
1954 | $this->logger->debug( __METHOD__ . ": Account linking failed by $id", [ |
|
1955 | 'user' => $user->getName(), |
|
1956 | ] ); |
|
1957 | $this->callMethodOnProviders( 3, 'postAccountLink', [ $user, $res ] ); |
|
1958 | $session->remove( 'AuthManager::accountLinkState' ); |
|
1959 | return $res; |
|
1960 | case AuthenticationResponse::REDIRECT; |
|
1961 | case AuthenticationResponse::UI; |
|
1962 | $this->logger->debug( __METHOD__ . ": Account linking $res->status by $id", [ |
|
1963 | 'user' => $user->getName(), |
|
1964 | ] ); |
|
1965 | $this->fillRequests( $res->neededRequests, self::ACTION_LINK, $user->getName() ); |
|
1966 | $state['continueRequests'] = $res->neededRequests; |
|
1967 | $session->setSecret( 'AuthManager::accountLinkState', $state ); |
|
1968 | return $res; |
|
1969 | default: |
|
1970 | throw new \DomainException( |
|
1971 | get_class( $provider ) . "::continuePrimaryAccountLink() returned $res->status" |
|
1972 | ); |
|
1973 | } |
|
1974 | } catch ( \Exception $ex ) { |
|
1975 | $session->remove( 'AuthManager::accountLinkState' ); |
|
1976 | throw $ex; |