src/SSOServer.php
public function attach(?string $broker, ?string $token, ?string $checksum)
    {
        try {
            if (!$broker) {
                $this->fail('No broker id specified.', true);
            }

            if (!$token) {
                $this->fail('No token specified.', true);
            }

            if (!$checksum || $checksum != $this->generateAttachChecksum($broker, $token)) {
                $this->fail('Invalid checksum.', true);
            }

            $this->startUserSession();
            $sessionId = $this->generateSessionId($broker, $token);

            $this->saveBrokerSessionData($sessionId, $this->getSessionData('id'));
        } catch (SSOServerException $e) {
            return $this->redirect(null, ['sso_error' => $e->getMessage()]);
        }

        $this->attachSuccess();
    }
public function attach(?string $broker, ?string $token, ?string $checksum)
    {
        try {
            if (!$broker) {
                $this->fail('No broker id specified.', true);
            }

            if (!$token) {
                $this->fail('No token specified.', true);
            }

            if (!$checksum || $checksum != $this->generateAttachChecksum($broker, $token)) {
                $this->fail('Invalid checksum.', true);
            }

            $this->startUserSession();
            $sessionId = $this->generateSessionId($broker, $token);

            $this->saveBrokerSessionData($sessionId, $this->getSessionData('id'));
        } catch (SSOServerException $e) {
            return $this->redirect(null, ['sso_error' => $e->getMessage()]);
        }

        $this->attachSuccess();
    }
public function attach ( ? string $ broker , ? string $ token , ? string $ checksum ) { try { if ( ! $ broker ) { $ this -> fail ( 'No broker id specified.' , true ) ; } if ( ! $ token ) { $ this -> fail ( 'No token specified.' , true ) ; } if ( ! $ checksum || $ checksum != $ this -> generateAttachChecksum ( $ broker , $ token ) ) { $ this -> fail ( 'Invalid checksum.' , true ) ; } $ this -> startUserSession ( ) ; $ sessionId = $ this -> generateSessionId ( $ broker , $ token ) ; $ this -> saveBrokerSessionData ( $ sessionId , $ this -> getSessionData ( 'id' ) ) ; } catch ( SSOServerException $ e ) { return $ this -> redirect ( null , [ 'sso_error' => $ e -> getMessage ( ) ] ) ; } $ this -> attachSuccess ( ) ; }
Attach user's session to broker's session.

@param string|null $broker Broker's name/id.
@param string|null $token Token sent from broker.
@param string|null $checksum Calculated broker+token checksum.

@return string or redirect
Attach user s session to broker s session .