src/Server.php
public function attach()
    {
        $this->detectReturnType();

        if (empty($_REQUEST['broker'])) {
            return $this->fail("No broker specified", 400);
        }

        if (empty($_REQUEST['token'])) {
            return $this->fail("No token specified", 400);
        }

        if (!$this->returnType) {
            return $this->fail("No return url specified", 400);
        }

        $checksum = $this->generateAttachChecksum($_REQUEST['broker'], $_REQUEST['token']);

        if (empty($_REQUEST['checksum']) || $checksum != $_REQUEST['checksum']) {
            return $this->fail("Invalid checksum", 400);
        }

        $this->startUserSession();
        $sid = $this->generateSessionId($_REQUEST['broker'], $_REQUEST['token']);

        $this->cache->set($sid, $this->getSessionData('id'));
        $this->outputAttachSuccess();
    }
public function attach()
    {
        $this->detectReturnType();

        if (empty($_REQUEST['broker'])) {
            return $this->fail("No broker specified", 400);
        }

        if (empty($_REQUEST['token'])) {
            return $this->fail("No token specified", 400);
        }

        if (!$this->returnType) {
            return $this->fail("No return url specified", 400);
        }

        $checksum = $this->generateAttachChecksum($_REQUEST['broker'], $_REQUEST['token']);

        if (empty($_REQUEST['checksum']) || $checksum != $_REQUEST['checksum']) {
            return $this->fail("Invalid checksum", 400);
        }

        $this->startUserSession();
        $sid = $this->generateSessionId($_REQUEST['broker'], $_REQUEST['token']);

        $this->cache->set($sid, $this->getSessionData('id'));
        $this->outputAttachSuccess();
    }
public function attach ( ) { $ this -> detectReturnType ( ) ; if ( empty ( $ _REQUEST [ 'broker' ] ) ) { return $ this -> fail ( "No broker specified" , 400 ) ; } if ( empty ( $ _REQUEST [ 'token' ] ) ) { return $ this -> fail ( "No token specified" , 400 ) ; } if ( ! $ this -> returnType ) { return $ this -> fail ( "No return url specified" , 400 ) ; } $ checksum = $ this -> generateAttachChecksum ( $ _REQUEST [ 'broker' ] , $ _REQUEST [ 'token' ] ) ; if ( empty ( $ _REQUEST [ 'checksum' ] ) || $ checksum != $ _REQUEST [ 'checksum' ] ) { return $ this -> fail ( "Invalid checksum" , 400 ) ; } $ this -> startUserSession ( ) ; $ sid = $ this -> generateSessionId ( $ _REQUEST [ 'broker' ] , $ _REQUEST [ 'token' ] ) ; $ this -> cache -> set ( $ sid , $ this -> getSessionData ( 'id' ) ) ; $ this -> outputAttachSuccess ( ) ; }
Attach a user session to a broker session
Attach a user session to a broker session