0
function User_CustomValidate(&$usr) {
    $appKey = "xxxxx";
    $safeurl =  'https://safe.xxxx.com/login/sso/SSOService?app=playbooks';

    // first call back after safe login - POST is set
    if ($_POST && isset($_POST['digest'])) 
    {
     $digest = $_POST["digest"];

     // set the session variables ...
     $_SESSION['username'] = $_POST["firstname"]." ".$_POST["lastname"];
     $_SESSION['firstname'] = $_POST["firstname"];
     $_SESSION['lastname'] = $_POST["lastname"];
     $_SESSION['email'] = $_POST["email"];
     $_SESSION['uid'] = $_POST["uid"];


     // Needed for key
     $uid = $_POST["uid"];
     $time = $_POST["time"];

     // Read the property file with the key and URL so this won't go into the main code ...
     // this sets $appKey and $safeurl

     $mykey = "".$uid.$time.$appKey;
     $mydigest = md5($mykey);
    }

    // session is not initialized as we never got the post above to set session vars
    // call now the safe login to get the post to set the session vars ...

    if (!isset($_SESSION['uid']) || empty($_SESSION['uid']))
    {

     // Read the property file with the key and URL so this won't go into the main code ...
     // this sets $appKey and $safeurl

     header("Location: ".$safeurl);
    }


    $usr = $_SESSION['uid'];        
    $this->setCurrentUserName($usr);
            return TRUE;   

    }   

我正在创建一个 SSO 函数,该函数应该将 SSO 摘要数据传递给我的应用程序。我遇到了一个我无法弄清楚的变量问题。我所有的 SESSION 变量都在工作,我可以在所有页面上清楚地看到它们的结果。因此,当我回显 $_SESSION['uid'] 时,我可以看到从我们的 SSO 传递的任何 uid。但是我没有从 $usr 那里得到任何东西。我有语句 $usr = $_SESSION['uid'] 并且它什么都不返回。但是,当我将 $usr 设置为 '888888' 时,它会返回该静态 uid 并且一切正常。如何正确传递会话 uid?

4

0 回答 0