當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authenticate::permeate方法代碼示例

本文整理匯總了PHP中Authenticate::permeate方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticate::permeate方法的具體用法?PHP Authenticate::permeate怎麽用?PHP Authenticate::permeate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authenticate的用法示例。


在下文中一共展示了Authenticate::permeate方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: authorize

 /**
  * Attempts to authorize user, if required by model call, and returns confirmation.
  * @return boolean TRUE if authorization requirements met, FALSE otherwise.
  */
 public function authorize()
 {
     $answer = FALSE;
     // Determine if authentication already obtained
     $authenticated_user = $this->user->whoIs();
     // Determine if credentials for authenticating have been provided
     if ($this->requires_authentication && strlen($authenticated_user) == 0) {
         if ($this->rest->hasKey('user_name') && ($this->rest->hasKey('password') || $this->rest->hasKey('password1'))) {
             $uname = $this->rest->getValue('user_name');
             $pword = $this->rest->hasKey('password') ? $this->rest->getValue('password') : $this->rest->getValue('password1');
             // Test credentials
             $auth_rest = new Rest(['user_name' => $uname]);
             $authentication = new Authenticate($auth_rest, $user, $view_class, $this->rest->getId(), $this->destination);
             $db_reply = json_decode($authentication->permeate(), TRUE);
             if (hash_equals($db_reply[0]->getValue('password_hash'), crypt($pword, $db_reply[0]->getValue('password_salt')))) {
                 $this->rest->setValue('authentication_status', TRUE);
                 $answer = TRUE;
                 //                    $answer = $this->passToController(
                 //                        $this->rest,
                 //                        $this->user,
                 //                        $this->view_class,
                 //                        $this->id,
                 //                        $this->destination,
                 //                        $this->osmosis_chain
                 //                    );
             } else {
                 $this->rest->setValue('authentication_status', "false");
                 //                    $this->rest->setValue('x', $this->id);
                 //                    $payload = new \Segment\utilities\Record($this->rest->getId());
                 //                    $rest = $this->rest->toAssocArray();
                 //                    foreach($rest as $column => $values){
                 //                        $payload->addend($column, $values);
                 //                    }
                 //                    $payload->addend('user', [
                 //                            $this->user
                 //                    ]);
                 //                    $payload->addend('view_class', [
                 //                            $this->view_class
                 //                    ]);
                 //                    $payload->
                 sleep(0.75);
                 // For attacks so failure has similar time to success
             }
         }
     } else {
         $this->rest->setValue('authentication_status', TRUE);
         $answer = isset($this->requires_authentication) ? !$this->requires_authentication : FALSE;
         //            $answer = $this->passToController(
         //                $this->rest,
         //                $this->user,
         //                $this->view_class,
         //                $this->id,
         //                $this->destination,
         //                $this->osmosis_chain
         //            );
     }
 }
開發者ID:Michael-Mosher,項目名稱:Segment,代碼行數:61,代碼來源:ctrlr.php


注:本文中的Authenticate::permeate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。