Public Member Functions | |
__set ($name, $value) | |
__get ($name) | |
hostExists ($url) | |
discover ($url) | |
authUrl ($identifier_select=null) | |
validate () | |
getAttributes () |
Protected Member Functions | |
request_curl ($url, $method='GET', $params=array()) | |
request_streams ($url, $method='GET', $params=array()) | |
request ($url, $method='GET', $params=array()) | |
build_url ($url, $parts) | |
htmlTag ($content, $tag, $attrName, $attrValue, $valueName) | |
sregParams () | |
axParams () | |
authUrl_v1 () | |
authUrl_v2 ($identifier_select) | |
getAxAttributes () | |
getSregAttributes () |
Protected Attributes | |
$server |
Static Protected Attributes | |
static | $ax_to_sreg |
This class provides a simple interface for OpenID (1.1 and 2.0) authentication. Supports Yadis discovery. The authentication process is stateless/dumb.
Usage: Sign-on with OpenID is a two step process: Step one is authentication with the provider: $openid = new LightOpenID; $openid->identity = 'ID supplied by user'; header('Location: ' . $openid->authUrl());
The provider then sends various parameters via GET, one of them is openid_mode. Step two is verification: if ($this->data['openid_mode']) { $openid = new LightOpenID; echo $openid->validate() ? 'Logged in.' : 'Failed'; }
Optionally, you can set $returnUrl and $realm (or $trustRoot, which is an alias). The default values for those are: $openid->realm = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST']; $openid->returnUrl = $openid->realm . $_SERVER['REQUEST_URI']; If you don't know their meaning, refer to any openid tutorial, or specification. Or just guess.
AX and SREG extensions are supported. To use them, specify $openid->required and/or $openid->optional before calling $openid->authUrl(). These are arrays, with values being AX schema paths (the 'path' part of the URL). For example: $openid->required = array('namePerson/friendly', 'contact/email'); $openid->optional = array('namePerson/first'); If the server supports only SREG or OpenID 1.1, these are automaticaly mapped to SREG names, so that user doesn't have to know anything about the server.
To get the values, use $openid->getAttributes().
The library requires PHP >= 5.1.2 with curl or http/https stream wrappers enabled.
Definition at line 47 of file LightOpenID.php.
LightOpenID::authUrl | ( | $identifier_select = null | ) |
Returns authentication url. Usually, you want to redirect your user to it.
String | $select_identifier | Whether to request OP to select identity for an user in OpenID 2. Does not affect OpenID 1. |
ErrorException |
Definition at line 588 of file LightOpenID.php.
References discover().
LightOpenID::discover | ( | $url | ) |
Performs Yadis and HTML discovery. Normally not used.
$url | Identity URL. |
ErrorException |
Definition at line 330 of file LightOpenID.php.
References htmlTag().
Referenced by authUrl(), and validate().
LightOpenID::getAttributes | ( | ) |
Gets AX/SREG attributes provided by OP. should be used only after successful validaton. Note that it does not guarantee that any of the required/optional parameters will be present, or that there will be no other attributes besides those specified. In other words. OP may provide whatever information it wants to.
Definition at line 729 of file LightOpenID.php.
LightOpenID::hostExists | ( | $url | ) |
Checks if the server specified in the url exists.
$url | url to check |
Definition at line 123 of file LightOpenID.php.
|
protected |
Helper function used to scan for <meta>/<link> tags and extract information from them
Definition at line 315 of file LightOpenID.php.
Referenced by discover().
LightOpenID::validate | ( | ) |
Performs OpenID verification with the OP.
ErrorException |
Definition at line 606 of file LightOpenID.php.
References discover().
|
staticprotected |
Definition at line 58 of file LightOpenID.php.