• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Authenticator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Authenticator的典型用法代码示例。如果您正苦于以下问题:PHP Authenticator类的具体用法?PHP Authenticator怎么用?PHP Authenticator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Authenticator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: Seomoz_Authority

 /**
  * Gets domain and URL authority from SEOmoz.
  *
  * @access		private
  * @link 		http://www.seomoz.org/api		The SEOmoz API
  * @return		array 					Returns array, containing authority data.
  */
 public static function Seomoz_Authority($uri)
 {
     // external helper class
     include_once 'ext/SeoMoz/Authenticator.php';
     $authenticator = new Authenticator();
     $url = urlencode($uri);
     $tmp = SEOstats::cURL('http://lsapi.seomoz.com/linkscape/url-metrics/' . $url . '?' . $authenticator->getAuthenticationStr());
     $data = json_decode($tmp);
     $result = array('Title' => $data->ut, 'URL' => $data->uu, 'External Links' => $data->ueid, 'Links' => $data->uid, 'URL Authority' => $data->upa, 'URL mozRank' => $data->umrp, 'Subdomain mozRank' => $data->fmrp, 'HTTP Status Code' => $data->us, 'Page Authority' => $data->upa, 'Domain Authority' => $data->pda);
     return $result;
 }
开发者ID:netconstructor,项目名称:SEOstats,代码行数:18,代码来源:seostats.seomoz.php


示例2: route

function route($handler, $module, $action)
{
    if ($handler == 'TTAM') {
        if ($module == 'Authenticator') {
            $auth = new Authenticator();
            if ($action = 'getToken') {
                $authCode = $_GET['code'];
                $data = $auth->getToken($authCode);
            }
        }
    }
}
开发者ID:noots2015,项目名称:23AndMe,代码行数:12,代码来源:index.php


示例3: initController

 private function initController()
 {
     $this->frontController = new FrontController();
     // Create the database interface objects and their proxies and register
     // them with the FrontController.
     $configuration = new Configuration($this->dbConnector);
     $entries = new Entries($this->dbConnector);
     $authenticator = new Authenticator($this->dbConnector);
     $captchaAuth = new CaptchaAuth($this->dbConnector);
     $authenticator->setMethodHandler(AuthMethods::CAPTCHA, new CaptchaAuthHandler($captchaAuth));
     $resolvers = array(new DirectClassResolver('configuration', $configuration, array('getAll' => array(), 'getByName' => array(Types::STRING))), new DirectClassResolver('entries', $entries, array('getEntryCount' => array(), 'getAllIds' => array(Types::STRING), 'getIdsForRange' => array(Types::STRING, Types::INT, Types::INT), 'getEntryById' => array(Types::INT), 'addEntry' => array(Types::STRING, Types::STRING, Types::STRING))), new ClassResolver('auth', new AuthServer($authenticator)), new ClassResolver('captchaAuth', new CaptchaAuthServer($captchaAuth)), new CaptchaImageResolver($captchaAuth));
     foreach ($resolvers as $resolver) {
         $this->frontController->addResolver(new AuthResolverProxy($resolver, $authenticator));
     }
 }
开发者ID:klickverbot,项目名称:theBlackboard,代码行数:15,代码来源:Core.php


示例4: test11RetrieveConceptFiletrStatus

 public function test11RetrieveConceptFiletrStatus()
 {
     // Use API to search for concept and filter on status
     // todo: test additionele zoek parameters
     print "\n" . "Test: get concept via filters";
     $client = Authenticator::authenticate();
     //prepare and send request
     $uri = BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . CONCEPT_prefLabel . '&status:' . CONCEPT_status_forfilter . '&tenant:' . TENANT . '&inScheme:' . CONCEPT_schema_forfilter;
     print "\n fileterd request's uri: " . $uri;
     $client->setUri($uri);
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     $client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'application/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     $response = $client->request(Zend_Http_Client::GET);
     // analyse respond
     if ($response->getStatus() != 200) {
         print "\n " . $response->getMessage();
     }
     print "\n Response Headers: ";
     var_dump($response->getHeaders());
     $this->AssertEquals(200, $response->getStatus());
     $namespaces = array("rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "skos" => "http://www.w3.org/2004/02/skos/core#", "openskos" => "http://openskos.org/xmlns/openskos.xsd");
     print "\n\n\n Response Body: ";
     var_dump($response->getBody());
     $dom = new Zend_Dom_Query();
     $dom->setDocumentXML($response->getBody());
     $dom->registerXpathNamespaces($namespaces);
     $elem = $dom->queryXpath('/rdf:RDF');
     $this->assertEquals($elem->current()->nodeType, XML_ELEMENT_NODE, 'The root node of the response is not an element');
     $resDescr = $dom->queryXpath('/rdf:RDF/rdf:Description');
     $resStatus = $dom->queryXpath('/rdf:RDF/rdf:Description/openskos:status');
     $this->assertEquals(1, $resDescr->count());
     $this->assertEquals($resDescr->count(), $resStatus->count(), "Not all result concepts have status field. ");
 }
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:33,代码来源:GetConceptTest.php


示例5: checkPassword

 /**
  * check if $passFromForm is same as $passFromDb
  * @param string $passFromDb
  * @param string $passFromForm
  * @return boolean
  */
 public static function checkPassword($passFromDb, $passFromForm)
 {
     if ($passFromDb === \Authenticator::calculateHash($passFromForm, $passFromDb)) {
         return TRUE;
     }
     return FALSE;
 }
开发者ID:VNovotna,项目名称:MP2014,代码行数:13,代码来源:Authenticator.php


示例6: onBeforeSecurityLogin

 /**
  * Will redirect the user directly to the IdP login endpoint if:
  *
  * 1) the 'SAMLAuthenticator' is the default authenticator
  * 2) there isn't a GET param showloginform set to 1
  * 3) the member is not currently logged in
  * 4) there are no form messages (errors or notices)
  *
  * @return void
  */
 public function onBeforeSecurityLogin()
 {
     if (Authenticator::get_default_authenticator() != 'SAMLAuthenticator') {
         return;
     }
     // by going to the URL Security/login?showloginform=1 we bypass the auto sign on
     if ($this->owner->request->getVar('showloginform') == 1) {
         return;
     }
     // if member is already logged in, don't auto-sign-on, this is most likely because
     // of unsufficient permissions.
     $member = Member::currentUser();
     if ($member && $member->exists()) {
         return;
     }
     // if there are form messages, don't auto-sign-on, this is most likely because of
     // login errors / failures or other notices.
     if (Session::get('FormInfo')) {
         // since FormInfo can be a "nulled" array, we have to check
         foreach (Session::get('FormInfo') as $form => $info) {
             foreach ($info as $name => $value) {
                 if ($value !== null) {
                     return;
                 }
             }
         }
     }
     $backURL = Session::get('BackURL');
     if ($this->owner->request->getVar('BackURL')) {
         $backURL = $this->owner->request->getVar('BackURL');
     }
     $authenticator = Injector::inst()->create('SAMLAuthenticator');
     $authenticator->authenticate(array("BackURL" => $backURL));
 }
开发者ID:eLBirador,项目名称:silverstripe-activedirectory,代码行数:44,代码来源:SAMLSecurityExtension.php


示例7: create_topic

function create_topic($request)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die('', 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        $model = new Model();
        if (!isset($input_data['name'])) {
            $input_data['name'] = '';
        }
        $topic_id = $model->create_topic($input_data['name']);
        if ($topic_id) {
            http_response_code(201);
            header('Content-Type: text/plain');
            echo '/topics/' . $topic_id;
            die;
        } else {
            Util::output_errors_and_die('', 400);
        }
    } catch (ConflictException $e) {
        Util::output_errors_and_die($e->getMessage(), 409);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:35,代码来源:create_topic.php


示例8: update_programming_language

function update_programming_language($pl_id, $request)
{
    Authenticator::assert_manager($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die('', 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        $result = $model->edit_programming_language($pl_id, $input_data);
        header('Content-Type: text/plain');
        http_response_code($result ? 200 : 404);
        die;
    } catch (ConflictException $e) {
        Util::output_errors_and_die($e->getMessage(), 409);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:27,代码来源:update_programming_language.php


示例9: test_auto_marking_sc

function test_auto_marking_sc($request)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale'], '/new-question/errors');
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die($msg->_('invalid-format'), 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data) || !isset($input_data['question']) || !isset($input_data['source-code']) || !is_string($input_data['source-code'])) {
            Util::output_errors_and_die($msg->_('invalid-format'), 400);
        }
        $extra = !empty($input_data['extra']) ? $input_data['extra'] : [];
        $qd = $input_data['question'];
        set_empty_if_undefined($qd['type']);
        if ($qd['type'] != 'source-code') {
            Util::output_errors_and_die('', 400);
        }
        $q = new QuestionSC($qd, Question::FROM_USER, $extra);
        $q->mark_automatically(array('source-code' => $input_data['source-code']), $log, $result);
        http_response_code(200);
        header('Content-Type: application/json');
        echo my_json_encode($result);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:32,代码来源:test_auto_marking_sc.php


示例10: tryLogin

/**
 * Try to perform a user login request.
 */
function tryLogin()
{
    global $req, $session, $msg, $nc;
    global $status;
    global $serverUri;
    if ($status === "unknown" && $req->check("action")) {
        $action = $req->getString("action");
        switch ($action) {
            case "login":
                if ($req->getSubmitButton("cancel")) {
                    $status = "unknown";
                    return;
                }
                assert($req->getSubmitButton("login"));
                $identity = $req->getString("identity");
                $signature = $req->getString("signature");
                $version = $req->getInteger("version");
                if ($version !== 1) {
                    throw new RuntimeException("Unsupported signature" . " version: {$version}");
                }
                /* Redirect to loginForm in case an exception is thrown
                   below (i. e., authentication fails).  */
                $status = "loginForm";
                $auth = new Authenticator($nc, $serverUri);
                try {
                    $res = $auth->login($identity, $signature, $session->getNonce());
                    assert($res === TRUE);
                    $session->setUser($identity);
                } catch (LoginFailure $err) {
                    throw new UIError($err->getMessage());
                }
                /* No exception thrown means success.  */
                $msg->addMessage("You have logged in successfully.");
                $status = "unknown";
                break;
            case "logout":
                $session->setUser(NULL);
                $msg->addMessage("You have been logged out successfully.");
                $status = "unknown";
                break;
            default:
                // Ignore unknown action request.
                break;
        }
    }
}
开发者ID:sekure,项目名称:nameid,代码行数:49,代码来源:index.php


示例11: test_auto_marking

function test_auto_marking($request)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale'], '/new-question/errors');
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die($msg->_('invalid-format'), 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data) || !isset($input_data['question']) || !isset($input_data['studentAnswer'])) {
            Util::output_errors_and_die($msg->_('invalid-format'), 400);
        }
        $extra = !empty($input_data['extra']) ? $input_data['extra'] : [];
        $qd = $input_data['question'];
        set_empty_if_undefined($qd['type']);
        if (!Validator::validate_question_type($qd['type'])) {
            Util::output_errors_and_die($msg->_('invalid-type'), 400);
        }
        switch ($qd['type']) {
            case 'short-answer':
                $q = new QuestionSA($qd, Question::FROM_USER, $extra);
                break;
            case 'essay':
                $q = new QuestionES($qd, Question::FROM_USER, $extra);
                break;
            case 'multiple-choice':
                $q = new QuestionMC($qd, Question::FROM_USER, $extra);
                break;
            case 'matching':
                $q = new QuestionMA($qd, Question::FROM_USER, $extra);
                break;
            case 'fitb-type':
                $q = new QuestionFT($qd, Question::FROM_USER, $extra);
                break;
            case 'fitb-select':
                $q = new QuestionFS($qd, Question::FROM_USER, $extra);
                break;
            case 'source-code':
                $q = new QuestionSC($qd, Question::FROM_USER, $extra);
                break;
        }
        http_response_code(200);
        header('Content-Type: application/json');
        $mark = $q->mark_automatically($input_data['studentAnswer'], $log);
        foreach ($log as $i => $line) {
            $log[$i] = $msg->_('/auto-marking/' . $line[0], $line[1]);
        }
        $log = implode('<br/>', $log);
        echo my_json_encode(array('log' => $log, 'mark' => $mark));
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:58,代码来源:test_auto_marking.php


示例12: getUrlMetrics

 /**
  * 
  * This method returns the metrics about a URL or set of URLs.  
  * 
  * @param objectURL
  * @param col This field filters the data to get only specific columns
  * 			  col = 0 fetches all the data
  * @return
  */
 public function getUrlMetrics($objectURL, $col = 0)
 {
     $urlToFetch = "http://lsapi.seomoz.com/linkscape/url-metrics/" . urlencode($objectURL) . "?" . Authenticator::getInstance()->getAuthenticationStr();
     if ($col > 0) {
         $urlToFetch = $urlToFetch . "&Cols=" . $col;
     }
     $response = ConnectionUtil::makeRequest($urlToFetch);
     return $response;
 }
开发者ID:netconstructor,项目名称:SEOstats,代码行数:18,代码来源:URLMetricsService.php


示例13: tearDown

 function tearDown()
 {
     // Restore selected authenticator
     // MemberAuthenticator might not actually be present
     if (!in_array('MemberAuthenticator', $this->priorAuthenticators)) {
         Authenticator::unregister('MemberAuthenticator');
     }
     Authenticator::set_default_authenticator($this->priorDefaultAuthenticator);
     parent::tearDown();
 }
开发者ID:racontemoi,项目名称:shibuichi,代码行数:10,代码来源:SecurityTest.php


示例14: create_question

function create_question($request, $assignment_id = null)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die('', 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        set_empty_if_undefined($input_data['type']);
        if (!Validator::validate_question_type($input_data['type'])) {
            Util::output_errors_and_die($msg->_('invalid-type'), 400);
        }
        switch ($input_data['type']) {
            case 'short-answer':
                $q = new QuestionSA($input_data, Question::FROM_USER);
                break;
            case 'essay':
                $q = new QuestionES($input_data, Question::FROM_USER);
                break;
            case 'multiple-choice':
                $q = new QuestionMC($input_data, Question::FROM_USER);
                break;
            case 'matching':
                $q = new QuestionMA($input_data, Question::FROM_USER);
                break;
            case 'fitb-type':
                $q = new QuestionFT($input_data, Question::FROM_USER);
                break;
            case 'fitb-select':
                $q = new QuestionFS($input_data, Question::FROM_USER);
                break;
            case 'source-code':
                $q = new QuestionSC($input_data, Question::FROM_USER);
                break;
        }
        $qid = $model->create_question($q);
        header('Content-Type: text/plain');
        echo '/question_bank/questions/' . $qid;
        http_response_code(201);
        die;
    } catch (ConflictException $e) {
        Util::output_errors_and_die($e->getMessage(), 409);
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:55,代码来源:create_question.php


示例15: tearDown

 function tearDown()
 {
     // Restore selected authenticator
     // MemberAuthenticator might not actually be present
     if (!in_array('MemberAuthenticator', $this->priorAuthenticators)) {
         Authenticator::unregister('MemberAuthenticator');
     }
     Authenticator::set_default_authenticator($this->priorDefaultAuthenticator);
     // Restore unique identifier field
     Member::set_unique_identifier_field($this->priorUniqueIdentifierField);
     parent::tearDown();
 }
开发者ID:eLBirador,项目名称:AllAboutCity,代码行数:12,代码来源:SecurityTest.php


示例16: userCredentialsSubmitted

 /**
  * @param Form $form
  */
 public function userCredentialsSubmitted($form)
 {
     $values = $form->getValues();
     $user = $this->userRepo->findById($this->user->id)->fetch();
     if (Authenticator::checkPassword($user->password, $values->oldpass)) {
         $this->userRepo->setPassword($this->user->id, $values->newpass);
         $this->flashMessage('Heslo nastaveno', 'success');
     } else {
         $this->flashMessage('Staré heslo bylo zadáno nesprávně', 'error');
     }
     $this->redirect('this');
 }
开发者ID:VNovotna,项目名称:MP2014,代码行数:15,代码来源:UserPresenter.php


示例17: update_user

function update_user($username, $request)
{
    $user_data = Authenticator::assert_manager($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale']);
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        switch ($content_type) {
            case 'application/json':
                $input_data = json_decode($raw_input, true);
                break;
            case 'application/x-www-form-urlencoded':
                $input_data = array();
                parse_str($raw_input, $input_data);
                break;
            default:
                Util::output_errors_and_die('', 415);
        }
        if (empty($input_data)) {
            Util::output_errors_and_die('', 400);
        }
        $changes = array();
        foreach ($input_data as $f => $v) {
            if (is_string($input_data[$f])) {
                $changes[$f] = trim($input_data[$f]);
            } else {
                Util::output_errors_and_die('', 400);
            }
        }
        if (isset($input_data['password'])) {
            // don't trim
            if (is_string($input_data['password'])) {
                $changes['password'] = $input_data['password'];
            } else {
                Util::output_errors_and_die('', 400);
            }
        }
        if ($model->update_user($username, $changes)) {
            echo $user_data['username'] . ' -> ' . $username;
            $model->insert_approvedby($user_data['username'], $username);
            http_response_code(204);
            die;
        } else {
            Util::output_errors_and_die('', 404);
        }
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:52,代码来源:update_user.php


示例18: test11RetrieveConceptFiletrStatus

 public function test11RetrieveConceptFiletrStatus()
 {
     // Use API to search for concept and filter on status
     // todo: test additionele zoek parameters
     print "\n" . "Test: get concept via filters";
     $client = Authenticator::authenticate();
     //prepare and send request
     $uri = BASE_URI_ . '/public/api/find-concepts?q=prefLabel:' . CONCEPT_prefLabel . '&status:' . CONCEPT_status_forfilter . '&tenant:' . TENANT . '&inScheme:' . CONCEPT_schema_forfilter;
     print "\n filtered request's uri: " . $uri . "\n";
     $client->setUri($uri);
     $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
     $client->SetHeaders(array('Accept' => 'text/html,application/xhtml+xml,application/xml', 'Content-Type' => 'application/xml', 'Accept-Language' => 'nl,en-US,en', 'Accept-Encoding' => 'gzip, deflate', 'Connection' => 'keep-alive'));
     $response = $client->request(Zend_Http_Client::GET);
     // analyse respond
     print "\n get status: " . $response->getMessage() . "\n";
     $this->AssertEquals(200, $response->getStatus());
     $namespaces = array("rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "skos" => "http://www.w3.org/2004/02/skos/core#", "openskos" => "http://openskos.org/xmlns/openskos.xsd");
     $dom = new Zend_Dom_Query();
     $dom->setDocumentXML($response->getBody());
     $dom->registerXpathNamespaces($namespaces);
     $elem = $dom->queryXpath('/rdf:RDF');
     $this->assertEquals(XML_ELEMENT_NODE, $elem->current()->nodeType, 'The root node of the response is not an element');
     $this->assertEquals(1, $elem->current()->getAttribute("openskos:numFound"));
     $resDescr = $dom->queryXpath('/rdf:RDF/rdf:Description');
     $i = 0;
     $l = $resDescr->count();
     $resDescr->rewind();
     while ($i < $l) {
         $labels = $resDescr->current()->getElementsByTagName("altLabel");
         //print "\n val:" . $labels ->item(0) ->textContent;
         $randomn = rand(0, 4096);
         $labels->item(0)->nodeValue = "test-1-" . $randomn;
         $doc = $resDescr->current()->ownerDocument;
         $xml = $doc->saveXML();
         var_dump($xml);
         // try $newdom isntead of $dom, which can be corrupted
         //$dom = new DOMDocument('1.0', 'utf-8');
         //$rdf = $dom -> createElement("rdf:RDF");
         //$dom ->importNode($newDescr, TRUE);// appendChild($rdf);
         //$rdf ->appendChild($newDescr);
         //$xml = $dom->saveXML();
         //var_dump($xml);
         $client->setUri(BASE_URI_ . "/public/api/concept?");
         $client->setConfig(array('maxredirects' => 0, 'timeout' => 30));
         $response = $client->setEncType('text/xml')->setRawData($xml)->setParameterGet('tenant', TENANT)->setParameterGet('collection', COLLECTION_1_code)->setParameterGet('key', API_KEY)->request(Zend_Http_Client::PUT);
         print "\n Update response message: " . $response->getMessage();
         $this->AssertEquals(200, $response->getStatus(), 'Update request returned worng status code');
         $resDescr->next();
         $i++;
     }
 }
开发者ID:OpenSKOS,项目名称:phpunittests,代码行数:51,代码来源:UpdateConcept.php


示例19: test_question

function test_question($request)
{
    Authenticator::assert_manager_or_professor($request->cookies['authToken']);
    $msg = new Messages($GLOBALS['locale'], '/new-question/errors');
    try {
        $model = new Model();
        $raw_input = $request->getBody();
        $content_type = explode(';', $request->type)[0];
        if ($content_type !== 'application/json') {
            Util::output_errors_and_die($msg->_('invalid-format'), 415);
        }
        $input_data = json_decode($raw_input, true);
        if (empty($input_data)) {
            Util::output_errors_and_die($msg->_('invalid-format'), 400);
        }
        set_empty_if_undefined($input_data['type']);
        if (!Validator::validate_question_type($input_data['type'])) {
            Util::output_errors_and_die($msg->_('invalid-type'), 400);
        }
        switch ($input_data['type']) {
            case 'short-answer':
                $q = new QuestionSA($input_data, Question::FROM_USER);
                break;
            case 'essay':
                $q = new QuestionES($input_data, Question::FROM_USER);
                break;
            case 'multiple-choice':
                $q = new QuestionMC($input_data, Question::FROM_USER);
                break;
            case 'matching':
                $q = new QuestionMA($input_data, Question::FROM_USER);
                break;
            case 'fitb-type':
                $q = new QuestionFT($input_data, Question::FROM_USER);
                break;
            case 'fitb-select':
                $q = new QuestionFS($input_data, Question::FROM_USER);
                break;
            case 'source-code':
                $q = new QuestionSC($input_data, Question::FROM_USER);
                break;
        }
        http_response_code(200);
        header('Content-Type: application/json');
        echo my_json_encode($q->to_auto_marking_test(true, true));
    } catch (DatabaseException $e) {
        Util::output_errors_and_die($e->getMessage(), 503);
    } catch (Exception $e) {
        Util::output_errors_and_die($e->getMessage(), 400);
    }
}
开发者ID:OrgAindaSemTitulo,项目名称:Sistema,代码行数:51,代码来源:test_question.php


示例20: tearDown

 public function tearDown()
 {
     // Restore selected authenticator
     // MemberAuthenticator might not actually be present
     if (!in_array('MemberAuthenticator', $this->priorAuthenticators)) {
         Authenticator::unregister('MemberAuthenticator');
     }
     foreach ($this->priorAuthenticators as $authenticator) {
         Authenticator::register($authenticator);
     }
     Authenticator::set_default_authenticator($this->priorDefaultAuthenticator);
     // Restore unique identifier field
     Member::config()->unique_identifier_field = $this->priorUniqueIdentifierField;
     Security::config()->remember_username = $this->priorRememberUsername;
     parent::tearDown();
 }
开发者ID:tcaiger,项目名称:mSupplyNZ,代码行数:16,代码来源:SecurityTest.php



注:本文中的Authenticator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Author类代码示例发布时间:2022-05-23
下一篇:
PHP AuthenticationController类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap