diff options
Diffstat (limited to 'Auth')
-rw-r--r-- | Auth/OpenID/Server.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Auth/OpenID/Server.php b/Auth/OpenID/Server.php index 3dbf194..01a1268 100644 --- a/Auth/OpenID/Server.php +++ b/Auth/OpenID/Server.php @@ -145,10 +145,13 @@ class Auth_OpenID_ServerError { /** * @access private */ - function Auth_OpenID_ServerError($message = null, $text = null) + function Auth_OpenID_ServerError($message = null, $text = null, + $reference = null, $contact = null) { $this->message = $message; $this->text = $text; + $this->contact = $contact; + $this->reference = $reference; } /** @@ -200,6 +203,26 @@ class Auth_OpenID_ServerError { 'error' => $this->toString())); } + function toMessage() + { + // Generate a Message object for sending to the relying party, + // after encoding. + $namespace = $this->message->getOpenIDNamespace(); + $reply = new Auth_OpenID_Message($namespace); + $reply->setArg(Auth_OpenID_OPENID_NS, 'mode', 'error'); + $reply->setArg(Auth_OpenID_OPENID_NS, 'error', $this->toString()); + + if ($this->contact !== null) { + $reply->setArg(Auth_OpenID_OPENID_NS, 'contact', $this->contact); + } + + if ($this->reference !== null) { + $reply->setArg(Auth_OpenID_OPENID_NS, 'reference', $this->reference); + } + + return $reply; + } + /** * Returns one of $_Auth_OpenID_Encode_Url, * $_Auth_OpenID_Encode_Kvform, or null, depending on the type of |