for me, this causes all my pages to jump to the discussion page (no matter what URL i'm pointed at). this means when i authenticate with ProxyConnect i can not access dashboard, individual discussions, profiles, etc etc...
if ($AuthResponse == Gdn_Authenticator::AUTH_SUCCESS) {
Gdn::Request()->WithRoute('DefaultController');
}
this works as i need, now i can access other parts of my forum when authenticating with proxyconnect.
if ($AuthResponse == Gdn_Authenticator::AUTH_SUCCESS) {
Gdn::Request();
}
however, i found an unimplemented function that was throwing errors and short circuiting the authentication process silently. i just commented it out. this doesn't feel right, but i don't fully understand the Nonces and whatnot to implement the function myself.
$UserEmail = ArrayValue('Email', $Response);
$UserName = ArrayValue('Name', $Response);
#make sure the uniqueID is read out from the response
$UserID = ArrayValue('UniqueID', $Response);
$UserName = trim(preg_replace('/[^a-z0-9-]+/i','',$UserName));
$TransientKey = ArrayValue('TransientKey', $Response, NULL);
#the below will use the email address to associate foreignkeys
#$AuthResponse = $this->ProcessAuthorizedRequest($Provider['AuthenticationKey'], $UserEmail, $UserName, $TransientKey);
#the below will use the user unique ID to associate foreignkeys
$AuthResponse = $this->ProcessAuthorizedRequest($Provider['AuthenticationKey'], $UserID, $UserName, $TransientKey);
in summary, the previous code changes will get the original service's userIDs to be used as the foreign keys, i've now got a working proxyconnect with a service running on a different subdomain as my forum.
if ($Token && !is_null($ForeignNonce)) {
$TokenKey = $Token['Token'];
#SetNonce is not implemented in this file (or i can't find where it is inherited from?)
#$this->SetNonce($TokenKey, $ForeignNonce);
}
class Gdn_ProxyAuthenticator extends Gdn_Authenticator implements Gdn_IHandshake { public function SetNonce($TokenKey, $Nonce, $Timestamp = NULL) {
$InsertArray = array(
'Token' => $TokenKey,
'Nonce' => $Nonce,
'Timestamp' => date('Y-m-d H:i:s',(is_null($Timestamp)) ? time() : $Timestamp)
);
try {
$NumAffected = Gdn::Database()->SQL()->Update('UserAuthenticationNonce')
->Set('Nonce', $Nonce)
->Set('Timestamp', $InsertArray['Timestamp'])
->Where('Token', $InsertArray['Token'])
->Put();
if (!$NumAffected->PDOStatement() || !$NumAffected->PDOStatement()->rowCount())
throw new Exception();
} catch (Exception $e) {
Gdn::Database()->SQL()->Insert('UserAuthenticationNonce', $InsertArray);
}
return TRUE;
}if (!$NumAffected->PDOStatement()->rowCount())if (!$NumAffected->PDOStatement() || !$NumAffected->PDOStatement()->rowCount())if ($Result) {
$ReturnArray = array(
'Email' => ArrayValue('Email', $Result),
'Name' => ArrayValue('Name', $Result),
'UniqueID' => ArrayValue('UniqueID', $Result),
'TransientKey' => ArrayValue('TransientKey', $Result)
);
return $ReturnArray;
}
to:
if ($Result) {
$ReturnArray = array(
'Email' => ArrayValue('Email', $Result),
'Name' => ArrayValue('Name', $Result),
'UniqueID' => ArrayValue('UniqueID', $Result),
'TransientKey' => ArrayValue('TransientKey', $Result, NULL)
);
return $ReturnArray;
}
now my TransientKey (which is not present in my json encoded user array) evaluates to NULL and that port of the code is never triggered.It looks like you're new here. If you want to get involved, click one of these buttons!