cando['external'] = true; $this->cando['logout'] = false; } function trustExternal($user, $pass, $sticky = false) { global $USERINFO; $baseDir = getBaseURL(true); $targetPath = $baseDir . 'userinfo.php';//만약 위 파일의 경로가 다르다면 여기도 고쳐준다. $arrContextOptions = array( "ssl" => array( "verify_peer" => true, ), "http" => array( 'header' => "Accept-language: ko\r\nCookie: ".session_name()."=".session_id()."\r\n" ) ); $time = ''.time(); $hash = hash('sha256', SESSION_KEY.$time, false); $result = @file_get_contents("{$targetPath}?time={$time}&hash={$hash}", false, stream_context_create($arrContextOptions)); if(!$result){ return false; } $logged_info = json_decode($result); if(!$logged_info->result){ throw new \RuntimeException($logged_info->reason); } if(!$logged_info->user_id){ return false; } $USERINFO['name'] = $logged_info->name; $USERINFO['mail'] = $logged_info->mail; $USERINFO['grps'] = $logged_info->grps; $_SERVER['REMOTE_USER'] = $logged_info->user_id; $_SESSION[DOKU_COOKIE]['auth']['user'] = $logged_info->user_id; $_SESSION[DOKU_COOKIE]['auth']['info'] = $USERINFO; return true; } }