ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
Auth_OpenID_AuthRequest Class Reference
+ Collaboration diagram for Auth_OpenID_AuthRequest:

Public Member Functions

 Auth_OpenID_AuthRequest ($endpoint, $assoc)
 Initialize an authentication request with the specified token, association, and endpoint. More...
 
 addExtension ($extension_request)
 Add an extension to this checkid request. More...
 
 addExtensionArg ($namespace, $key, $value)
 Add an extension argument to this OpenID authentication request. More...
 
 setAnonymous ($is_anonymous)
 Set whether this request should be made anonymously. More...
 
 getMessage ($realm, $return_to=null, $immediate=false)
 Produce a Auth_OpenID_Message representing this request. More...
 
 redirectURL ($realm, $return_to=null, $immediate=false)
 
 formMarkup ($realm, $return_to=null, $immediate=false, $form_tag_attrs=null)
 Get html for a form to submit this request to the IDP. More...
 
 htmlMarkup ($realm, $return_to=null, $immediate=false, $form_tag_attrs=null)
 Get a complete html document that will autosubmit the request to the IDP. More...
 
 shouldSendRedirect ()
 

Detailed Description

Definition at line 1741 of file Consumer.php.

Member Function Documentation

◆ addExtension()

Auth_OpenID_AuthRequest::addExtension (   $extension_request)

Add an extension to this checkid request.

$extension_request: An object that implements the extension request interface for adding arguments to an OpenID message.

Definition at line 1767 of file Consumer.php.

1768  {
1769  $extension_request->toMessage($this->message);
1770  }

◆ addExtensionArg()

Auth_OpenID_AuthRequest::addExtensionArg (   $namespace,
  $key,
  $value 
)

Add an extension argument to this OpenID authentication request.

Use caution when adding arguments, because they will be URL-escaped and appended to the redirect URL, which can easily get quite long.

Parameters
string$namespaceThe namespace for the extension. For example, the simple registration extension uses the namespace 'sreg'.
string$keyThe key within the extension namespace. For example, the nickname field in the simple registration extension's key is 'nickname'.
string$valueThe value to provide to the server for this argument.

Definition at line 1791 of file Consumer.php.

References $namespace.

1792  {
1793  return $this->message->setArg($namespace, $key, $value);
1794  }
if($err=$client->getError()) $namespace

◆ Auth_OpenID_AuthRequest()

Auth_OpenID_AuthRequest::Auth_OpenID_AuthRequest (   $endpoint,
  $assoc 
)

Initialize an authentication request with the specified token, association, and endpoint.

Users of this library should not create instances of this class. Instances of this class are created by the library when needed.

Definition at line 1751 of file Consumer.php.

1752  {
1753  $this->assoc = $assoc;
1754  $this->endpoint = $endpoint;
1755  $this->return_to_args = array();
1756  $this->message = new Auth_OpenID_Message(
1757  $endpoint->preferredNamespace());
1758  $this->_anonymous = false;
1759  }

◆ formMarkup()

Auth_OpenID_AuthRequest::formMarkup (   $realm,
  $return_to = null,
  $immediate = false,
  $form_tag_attrs = null 
)

Get html for a form to submit this request to the IDP.

form_tag_attrs: An array of attributes to be added to the form tag. 'accept-charset' and 'enctype' have defaults that can be overridden. If a value is supplied for 'action' or 'method', it will be replaced.

Definition at line 1928 of file Consumer.php.

References Auth_OpenID\isFailure().

1930  {
1931  $message = $this->getMessage($realm, $return_to, $immediate);
1932 
1933  if (Auth_OpenID::isFailure($message)) {
1934  return $message;
1935  }
1936 
1937  return $message->toFormMarkup($this->endpoint->server_url,
1938  $form_tag_attrs);
1939  }
getMessage($realm, $return_to=null, $immediate=false)
Produce a Auth_OpenID_Message representing this request.
Definition: Consumer.php:1835
static isFailure($thing)
Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.
Definition: OpenID.php:118
+ Here is the call graph for this function:

◆ getMessage()

Auth_OpenID_AuthRequest::getMessage (   $realm,
  $return_to = null,
  $immediate = false 
)

Produce a Auth_OpenID_Message representing this request.

Parameters
string$realmThe URL (or URL pattern) that identifies your web site to the user when she is authorizing it.
string$return_toThe 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.

Parameters
bool$immediateIf 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.

Definition at line 1835 of file Consumer.php.

References Auth_OpenID\appendArgs(), Auth_OpenID_IDENTIFIER_SELECT, Auth_OpenID_OPENID2_NS, and Auth_OpenID_OPENID_NS.

1836  {
1837  if ($return_to) {
1838  $return_to = Auth_OpenID::appendArgs($return_to,
1839  $this->return_to_args);
1840  } else if ($immediate) {
1841  // raise ValueError(
1842  // '"return_to" is mandatory when
1843  //using "checkid_immediate"')
1844  return new Auth_OpenID_FailureResponse(null,
1845  "'return_to' is mandatory when using checkid_immediate");
1846  } else if ($this->message->isOpenID1()) {
1847  // raise ValueError('"return_to" is
1848  // mandatory for OpenID 1 requests')
1849  return new Auth_OpenID_FailureResponse(null,
1850  "'return_to' is mandatory for OpenID 1 requests");
1851  } else if ($this->return_to_args) {
1852  // raise ValueError('extra "return_to" arguments
1853  // were specified, but no return_to was specified')
1854  return new Auth_OpenID_FailureResponse(null,
1855  "extra 'return_to' arguments where specified, " .
1856  "but no return_to was specified");
1857  }
1858 
1859  if ($immediate) {
1860  $mode = 'checkid_immediate';
1861  } else {
1862  $mode = 'checkid_setup';
1863  }
1864 
1865  $message = $this->message->copy();
1866  if ($message->isOpenID1()) {
1867  $realm_key = 'trust_root';
1868  } else {
1869  $realm_key = 'realm';
1870  }
1871 
1872  $message->updateArgs(Auth_OpenID_OPENID_NS,
1873  array(
1874  $realm_key => $realm,
1875  'mode' => $mode,
1876  'return_to' => $return_to));
1877 
1878  if (!$this->_anonymous) {
1879  if ($this->endpoint->isOPIdentifier()) {
1880  // This will never happen when we're in compatibility
1881  // mode, as long as isOPIdentifier() returns False
1882  // whenever preferredNamespace() returns OPENID1_NS.
1883  $claimed_id = $request_identity =
1885  } else {
1886  $request_identity = $this->endpoint->getLocalID();
1887  $claimed_id = $this->endpoint->claimed_id;
1888  }
1889 
1890  // This is true for both OpenID 1 and 2
1891  $message->setArg(Auth_OpenID_OPENID_NS, 'identity',
1892  $request_identity);
1893 
1894  if ($message->isOpenID2()) {
1895  $message->setArg(Auth_OpenID_OPENID2_NS, 'claimed_id',
1896  $claimed_id);
1897  }
1898  }
1899 
1900  if ($this->assoc) {
1901  $message->setArg(Auth_OpenID_OPENID_NS, 'assoc_handle',
1902  $this->assoc->handle);
1903  }
1904 
1905  return $message;
1906  }
const Auth_OpenID_OPENID_NS
Definition: Message.php:42
const Auth_OpenID_OPENID2_NS
Definition: Message.php:35
static appendArgs($url, $args)
"Appends" query arguments onto a URL.
Definition: OpenID.php:324
const Auth_OpenID_IDENTIFIER_SELECT
Import tools needed to deal with messages.
Definition: Message.php:18
+ Here is the call graph for this function:

◆ htmlMarkup()

Auth_OpenID_AuthRequest::htmlMarkup (   $realm,
  $return_to = null,
  $immediate = false,
  $form_tag_attrs = null 
)

Get a complete html document that will autosubmit the request to the IDP.

Wraps formMarkup. See the documentation for that function.

Definition at line 1947 of file Consumer.php.

References Auth_OpenID\autoSubmitHTML(), and Auth_OpenID\isFailure().

1949  {
1950  $form = $this->formMarkup($realm, $return_to, $immediate,
1951  $form_tag_attrs);
1952 
1953  if (Auth_OpenID::isFailure($form)) {
1954  return $form;
1955  }
1956  return Auth_OpenID::autoSubmitHTML($form);
1957  }
static autoSubmitHTML($form, $title="OpenId transaction in progress")
Definition: OpenID.php:532
formMarkup($realm, $return_to=null, $immediate=false, $form_tag_attrs=null)
Get html for a form to submit this request to the IDP.
Definition: Consumer.php:1928
static isFailure($thing)
Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.
Definition: OpenID.php:118
+ Here is the call graph for this function:

◆ redirectURL()

Auth_OpenID_AuthRequest::redirectURL (   $realm,
  $return_to = null,
  $immediate = false 
)

Definition at line 1908 of file Consumer.php.

References Auth_OpenID\isFailure().

1910  {
1911  $message = $this->getMessage($realm, $return_to, $immediate);
1912 
1913  if (Auth_OpenID::isFailure($message)) {
1914  return $message;
1915  }
1916 
1917  return $message->toURL($this->endpoint->server_url);
1918  }
getMessage($realm, $return_to=null, $immediate=false)
Produce a Auth_OpenID_Message representing this request.
Definition: Consumer.php:1835
static isFailure($thing)
Return true if $thing is an Auth_OpenID_FailureResponse object; false if not.
Definition: OpenID.php:118
+ Here is the call graph for this function:

◆ setAnonymous()

Auth_OpenID_AuthRequest::setAnonymous (   $is_anonymous)

Set whether this request should be made anonymously.

If a request is anonymous, the identifier will not be sent in the request. This is only useful if you are making another kind of request with an extension in this request.

Anonymous requests are not allowed when the request is made with OpenID 1.

Definition at line 1805 of file Consumer.php.

1806  {
1807  if ($is_anonymous && $this->message->isOpenID1()) {
1808  return false;
1809  } else {
1810  $this->_anonymous = $is_anonymous;
1811  return true;
1812  }
1813  }

◆ shouldSendRedirect()

Auth_OpenID_AuthRequest::shouldSendRedirect ( )

Definition at line 1959 of file Consumer.php.

1960  {
1961  return $this->endpoint->compatibilityMode();
1962  }

The documentation for this class was generated from the following file: