当前位置: 首页>>代码示例>>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;未经允许,请勿转载。