diff --git a/classes.svg b/classes.svg new file mode 100644 index 0000000..c2a6062 --- /dev/null +++ b/classes.svg @@ -0,0 +1,128 @@ + + + + + diff --git a/classes/Opauth.AbstractStrategy.html b/classes/Opauth.AbstractStrategy.html new file mode 100644 index 0000000..9f615e3 --- /dev/null +++ b/classes/Opauth.AbstractStrategy.html @@ -0,0 +1,780 @@ + + +
+ + +Opauth Strategy +Individual strategies are to be extended from this class
++ package + | +
+ Opauth + + |
+
---|
__construct(array $config = array())+
+ + | ++ | +
---|---|
+ + | ++ | +
array
Strategy-specific configuration
+ +callbackUrl($url = null)+
+ + | ++ | +
---|---|
+ + | ++ | +
+
+setTransport(\Opautth\Transport\TransportInterface $transport)+
+ + | ++ | +
---|---|
+ + | ++ | +
\Opautth\Transport\TransportInterface
+
+sessionData(array $data = null)+
+ + | ++ | +
---|
array
Array to write or null to read
+ +addParams(array $configKeys, array $params = array())+
$configKeys array may contain string values, or key => value pairs +key for the strategy key, value for the params key to set
++ + | ++ | +
---|
array
+
+array
+
+response(mixed $raw, array $error = array())+
More info: https://github.com/uzyn/opauth/wiki/Auth-response#wiki-error-response
++ + | ++ | +
---|
mixed
Raw response from Oauth provider
+ +array
Data on error to be sent back along with the callback +$error = array( + 'code' // Error code, can be int (HTTP status) or string (eg. access_denied) + 'message' // User-friendly error message +)
+ +setValues($values = array())+
+ + | ++ | +
---|---|
+ + | ++ | +
+ + | ++ | +
+
+value(string $key, string $default = null)+
+ + | ++ | +
---|
string
Configuration key to be loaded
+ +string
Default value for the configuration key if none is set by the user
+ +checkExpected()+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
hasKey(string $key, string $not = null)+
+ + | ++ | +
---|
string
Expected configuration key
+ +string
Value should not match this
+ +recursiveGetObjectVars(mixed $obj)+
+ + | ++ | +
---|
mixed
Object
+ +envReplace(string $value, array $dictionary)+
+ + | ++ | +
---|
string
Input string
+ +array
Dictionary to lookup values from
+ +expects+
defaults+
strategy+
sessionKey+
responseMap+
callbackUrl+
http+
AutoLoader
++ package + | +
+ Opauth + + |
+
---|
__construct($namespace = null, string $baseDirectory = null)+
+ + | ++ | +
---|---|
+ + | ++ | +
+
+string
+
+register($namespace = null, $dir = null)+
+ + | ++ | +
---|---|
+ + | ++ | +
+
+
+
+unregister($namespace = null, $dir = null)+
+ + | ++ | +
---|---|
+ + | ++ | +
+
+
+
+loadClass(string $className)+
+ + | ++ | +
---|
string
The name of the class to load.
+ +directory+
namespace+
namespaceLength+
Opauth +Multi-provider authentication framework for PHP
++ package + | +
+ Opauth + + |
+
---|
__construct(array $config = array())+
+ + | ++ | +
---|
array
User configuration
+ +config(\Opauth\type $key)+
+ + | ++ | +
---|
\Opauth\type
Configuration key
+ +run()+
When running request()
it will do a redirect, callback
returns Opauth Response object
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
request()+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
+ + | ++ | +
callback()+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
buildStrategies(array $strategies)+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
array
Array of strategies and their settings
+ +buildStrategy(string|integer $name, array|string $settings)+
+ + | ++ | +
---|
string|integer
+
+array|string
+
+loadStrategy()+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
setStrategy(\Opauth\AbstractStrategy $strategy)+
+ + | ++ | +
---|---|
+ + | ++ | +
strategy+
strategies+
request+
response+
config+
Opauth Request +Parses current request parameters
++ package + | +
+ Opauth + + |
+
---|
__construct(string $path = '/')+
+ + | ++ | +
---|---|
+ + | ++ | +
string
+
+parseUri()+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
+ + | ++ | +
getHost()+
+ + | ++ | +
---|
providerUrl()+
+ + | ++ | +
---|
urlname+
action+
path+
Opauth Response +Individual strategies should return this in their callback() method
++ package + | +
+ Opauth + + |
+
---|
__construct(string $provider, array $raw)+
+ + | ++ | +
---|---|
+ + | ++ | +
string
Use $this->strategy['provider'] so aliassed strategies are handled correct
+ +array
Raw response data from provider
+ +isError()+
+ + | ++ | +
---|
errorMessage()+
+ + | ++ | +
---|
errorCode()+
+ + | ++ | +
---|
setError(array $error)+
+ + | ++ | +
---|---|
+ + | ++ | +
array
Array with code and message keys
+ +isValid()+
+ + | ++ | +
---|
setData(string $path, string $rawPath)+
Uses paths to data, Use dot(.) to separate levels +Examples: +- Path to $response->info['a']['b']['c'] would be 'info.a.b.c' +- setData('info.nickname', 'screen_name') sets value from $response->raw['screen_name'] to $response->info['nickname'] +- setData('uid', 'nested.user_id') sets value from $response->raw['nested']['userid'] to $response->uid
++ + | ++ | +
---|---|
+ + | ++ | +
string
Path to property. eg 'info.nickname' sets to $info['nickname']
+ +string
Path to a $raw data. eg 'screen_name' reads from $raw['screen_name']
+ +setMap(array $map = array())+
+ + | ++ | +
---|---|
+ + | ++ | +
array
+
+getMap()+
+ + | ++ | +
---|
map()+
+ + | ++ | +
---|---|
+ + | ++ | +
getRaw(\Opauth\type $path)+
+ + | ++ | +
---|
\Opauth\type
see setData()
+ +mergeValue(\Opauth\type $path, \Opauth\type $value)+
+ + | ++ | +
---|
\Opauth\type
path to Property see setData()
+ +\Opauth\type
value to set
+ +offsetGet(string $name)+
+ + | ++ | +
---|
string
Name of the key being accessed.
+ +offsetSet(string $name, mixed $value)+
+ + | ++ | +
---|
string
Name of the key being written
+ +mixed
The value being written.
+ +offsetExists(string $name)+
+ + | ++ | +
---|
string
thing to check.
+ +offsetUnset(string $name)+
+ + | ++ | +
---|
string
Name to unset.
+ +__get(\Opauth\type $name)+
+ + | ++ | +
---|
\Opauth\type
+
+__isset(\Opauth\type $name)+
+ + | ++ | +
---|
\Opauth\type
+
+provider+
raw+
uid+
name+
credentials+
info+
map+
Key contains dot formatted path to Response attributes, +values contain path to raw data to read from.
+ +Strategies can define a response map, or users can add 'responseMap' to +the config array, to override and define the way they like the response +data to be formatted
+ +Example: +protected $responseMap = array( + 'uid' => 'id', + 'name' => 'name', + 'info.name' => 'name', + 'info.nickname' => 'screen_name', + 'info.location' => 'location', + 'info.description' => 'description', + 'info.image' => 'profile_image_url', + 'info.urls.website' => 'url' +);
+error+
Opauth Base client +Base class for built in Curl and File transport classes
++ package + | +
+ Opauth + + |
+
---|
redirect(string $url, array $data = array(), boolean $exit = true)+
+ + | ++ | +
---|---|
+ + | ++ | +
string
Destination URL
+ +array
Data
+ +boolean
Whether to call exit() right after redirection
+ +get(string $url, array $data = array())+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be submitted via GET
+ +post(string $url, array $data)+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be POSTed
+ +buildQuery(array $data)+
+ + | ++ | +
---|
array
+
+responseHeaders+
userAgent+
Opauth Curl +Curl transport class
++ package + | +
+ Opauth + + |
+
---|
request(string $url, array $options = array())+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
string
+
+array
+
+redirect(string $url, array $data = array(), boolean $exit = true)+
+ + | ++ | +
---|---|
+ + | ++ | +
string
Destination URL
+ +array
Data
+ +boolean
Whether to call exit() right after redirection
+ +get(string $url, array $data = array())+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be submitted via GET
+ +post(string $url, array $data)+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be POSTed
+ +buildQuery(array $data)+
+ + | ++ | +
---|
array
+
+responseHeaders+
userAgent+
Opauth Curl +File transport class, uses file_get_contents for environments where curl is not available
++ package + | +
+ Opauth + + |
+
---|
request(string $url, array $options = array())+
+ throws + | ++ + + | +
---|---|
+ + | ++ | +
string
+
+array
+
+redirect(string $url, array $data = array(), boolean $exit = true)+
+ + | ++ | +
---|---|
+ + | ++ | +
string
Destination URL
+ +array
Data
+ +boolean
Whether to call exit() right after redirection
+ +get(string $url, array $data = array())+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be submitted via GET
+ +post(string $url, array $data)+
+ + | ++ | +
---|
string
Destination URL
+ +array
Data to be POSTed
+ +buildQuery(array $data)+
+ + | ++ | +
---|
array
+
+responseHeaders+
userAgent+
redirect($url, $data = array(), $exit = true)+
+ + | ++ | +
---|---|
+ + | ++ | +
+ + | ++ | +
+
+
+
+
+
+get($url, $data = array())+
+ + | ++ | +
---|---|
+ + | ++ | +
+ + | ++ | +
+
+
+
+post($url, $data)+
+ + | ++ | +
---|---|
+ + | ++ | +
+ + | ++ | +
+
+
+
+__construct()
callback()
debug()
run()
validate()
loadStrategies()
parseUri()
requireStrategy()
$config
$env
$strategyMap
Opauth -Multi-provider authentication framework for PHP
-package | -Opauth | -
---|
__construct(array $config, boolean $run)- -
array
User configuration
boolean
Whether Opauth should auto run after initialization.
callback()- -
Refer to example/callback.php on how to handle auth callback.
debug(mixed $var)- -
mixed
Object or variable to be printed
run()- -
validate(string $input, string $timestamp, string $signature, string $reason) : boolean- -
string
= sha1(print_r($auth, true))
-string
= $_REQUEST['timestamp'])
-string
= $_REQUEST['signature']
-string
Sets reason for failure if validation fails
boolean
true: valid; false: not valid.loadStrategies()- -
parseUri()- -
requireStrategy(string $strategy) : string- -
string
Name of a strategy
string
Class name of the strategy, usually StrategyStrategy$config- -
$env- -
$strategyMap- -
__construct()
callAction()
callback()
clientGet()
clientPost()
envReplace()
errorCallback()
flattenArray()
hash()
httpRequest()
recursiveGetObjectVars()
redirect()
request()
serverGet()
serverPost()
expects()
mapProfile()
optional()
sign()
shipToCallback()
$auth
$defaults
$expects
$name
$env
$strategy
Opauth Strategy -Individual strategies are to be extended from this class
-package | -Opauth.Strategy | -
---|
__construct(array $strategy, array $env)- -
array
Strategy-specific configuration
-array
Safe env values from Opauth, with critical parameters stripped out
callAction(string $action, string $defaultAction)- -
string
Action name to call
string
If an action is not defined in a strategy, calls $defaultAction
-callback()- -
Set shipping transport via callback_transport config, default being session.
clientGet(string $url, array $data, boolean $exit)- -
string
Destination URL
array
Data
boolean
Whether to call exit() right after redirection
-clientPost(string $url, array $data)- -
string
URL to be POSTed
array
Data to be POSTed
envReplace(string $value, array $dictionary) : string- -
string
Input string
array
Dictionary to lookup values from
string
String substitued with value from dictionary, if applicableerrorCallback(array $error)- -
More info: https://github.com/uzyn/opauth/wiki/Auth-response#wiki-error-response
-array
Data on error to be sent back along with the callback $error = array( 'provider' // Provider name 'code' // Error code, can be int (HTTP status) or string (eg. access_denied) 'message' // User-friendly error message 'raw' // Actual detail on the error, as returned by the provider )
-flattenArray(array $array, string $prefix, array $results) : array- -
array
Array to be flatten
string
String to be prefixed to flatenned variable name
array
Existing array of flattened inputs to be merged upon
array
A single dimensional array with POST-friendly namehash(string $input, string $timestamp, int $iteration, string $salt) : string- -
string
Input string
string
ISO 8601 formatted date
int
Number of hash interations
string
-string
Resulting hashhttpRequest(string $url, array $options, string $responseHeaders) : string- -
See serverGet() and serverPost() for wrapper functions of httpRequest() - -Notes: -Reluctant to use any more advanced transport like cURL for the time being to not - having to set cURL as being a requirement. -Strategy is to provide own HTTP transport handler if requiring more advanced support.
-string
Full URL to load
array
Stream context options (http://php.net/stream-context-create)
-string
Response headers after HTTP call. Useful for error debugging.
string
Content resulted from request, without headersrecursiveGetObjectVars(mixed $obj) : array- -
mixed
Object
array
Array of object propertiesredirect(string $url, boolean $exit)- -
string
URL to redirect user to
boolean
Whether to call exit() right after redirection
-request()- -
serverGet(string $url, array $data, array $options, string $responseHeaders) : string- -
string
Destination URL
array
Data to be submitted via GET
array
Additional stream context options, if any
string
Response headers after HTTP call. Useful for error debugging.
string
Content resulted from request, without headersserverPost(string $url, array $data, array $options, string $responseHeaders) : string- -
string
Destination URL
array
Data to be POSTed
array
Additional stream context options, if any
string
Response headers after HTTP call. Useful for error debugging.
string
Content resulted from request, without headersexpects(string $key, string $not) : mixed- -
string
Expected configuration key
string
If value is set as $not, trigger E_USER_ERROR
-mixed
The loaded valuemapProfile(array $profile, string $profile_path, string $auth_path)- -
array
User profile obtained from provider
string
Path to a $profile property. Use dot(.) to separate levels. eg. Path to $profile['a']['b']['c'] would be 'a.b.c'
-string
Path to $this->auth that is to be set.
-optional(string $key, string $default) : mixed- -
string
Configuration key to be loaded
string
Default value for the configuration key if none is set by the user
mixed
The loaded valuesign(string $timestamp) : string- -
string
ISO 8601 formatted date
string
Resulting signatureshipToCallback(array $data, string $transport)- -
array
Data to be sent
string
Callback method, either 'get', 'post' or 'session' 'session': Default. Works best unless callback_url is on a different domain than Opauth 'post': Works cross-domain, but relies on availability of client-side JavaScript. 'get': Works cross-domain, but may be limited or corrupted by browser URL length limit (eg. IE8/IE9 has 2083-char limit)
-$auth- -
$defaults- -
$expects- -
$name- -
$env- -
$strategy- -
Type | +Line | +Description | +
---|---|---|
error | +12 | +No summary for interface \Opauth\TransportInterface | +
Type | +Line | +Description | +
---|---|---|
error | +134 | +No summary for method callback() | +
Type | +Line | +Description | +
---|---|---|
error | +19 | +No summary for property $directory | +
Opauth StrategyInterface +Individual strategies should implement this interface
+ + « More » +Opauth + + + +
Opauth + + + +
Opauth StrategyInterface +Individual strategies should implement this interface
+ + « More » +Opauth Base client +Base class for built in Curl and File transport classes
+ + « More » +Opauth Curl +File transport class, uses file_get_contents for environments where curl is not available
+ + « More » +Opauth StrategyInterface +Individual strategies should implement this interface
+ + « More » +Opauth Base client +Base class for built in Curl and File transport classes
+ + « More » +Opauth Curl +File transport class, uses file_get_contents for environments where curl is not available
+ + « More » +