Produce a {@link Auth_OpenID_Message} representing this
request.
public getMessage ( string $realm, string $return_to = null, boolean $immediate = false ) | ||
$realm | string | The URL (or URL pattern) that identifies your web site to the user when she is authorizing it. |
$return_to | string | The URL that the OpenID provider will send the user back to after attempting to verify her identity. Not specifying a return_to URL means that the user will not be returned to the site issuing the request upon its completion. |
$immediate | boolean | If true, the OpenID provider is to send back a response immediately, useful for behind-the-scenes authentication attempts. Otherwise the OpenID provider may engage the user before providing a response. This is the default case, as the user may need to provide credentials or approve the request before a positive response can be sent. |
/** * Build auth request * * @return mixed */ function buildRedirect() { $sreg_request = Auth_OpenID_SRegRequest::build(null, $this->sregFields); if ($sreg_request) { $this->_auth_request->addExtension($sreg_request); } $pape_request = new Auth_OpenID_PAPE_Request($this->pape_policy_uris); if ($pape_request) { $this->_auth_request->addExtension($pape_request); } $this->_message = $this->_auth_request->getMessage($this->getTrustRoot(), $this->getReturnTo()); if (Auth_OpenID::isFailure($this->_message)) { $this->_error = "Could not redirect to server: " . $this->_message->message; return false; } else { return true; } }
/** * Send the user to their OpenID provider to authenticate. * * @param Auth_OpenID_AuthRequest $auth_request OpenID authentication request object * @param string $trust_root OpenID trust root * @param string $return_to URL where the OpenID provider should return the user */ function openid_doRedirect($auth_request, $trust_root, $return_to) { if ($auth_request->shouldSendRedirect()) { $trust_root = trailingslashit($trust_root); $redirect_url = $auth_request->redirectURL($trust_root, $return_to); if (Auth_OpenID::isFailure($redirect_url)) { openid_error('Could not redirect to server: ' . $redirect_url->message); } else { wp_redirect($redirect_url); } } else { // Generate form markup and render it $request_message = $auth_request->getMessage($trust_root, $return_to, false); if (Auth_OpenID::isFailure($request_message)) { openid_error('Could not redirect to server: ' . $request_message->message); } else { openid_repost($auth_request->endpoint->server_url, $request_message->toPostArgs()); } } }