Opauth configurations¶
Instantiation of Opauth class accepts a configuration array as input.
require 'vendor/autoload.php';
$config = array(
'path' => '/auth/',
'http_client' => "Opauth\\Opauth\\HttpClient\\Curl",
'callback' => 'callback',
'Strategy' => array(
//strategy configurations should go here
//See Strategy configuration section
)
)
$Opauth = new Opauth\Opauth\Opauth($config);
$response = $Opauth->run();
path- Default:
/ - Path where Opauth is accessed.
- Begins and ends with
/ - For example, if Opauth is reached at
http://example.org/auth/,pathshould be set to/auth/; if Opauth is reached athttp://auth.example.org/,pathshould be set to/
- Default:
http_client- Default:
Opauth\\Opauth\\HttpClient\\Curlfor cURL (requiresphp_curl) - Client to be used by Opauth for making HTTP calls to authentication providers.
- Opauth also ships with other HTTP clients.
- Default:
callback- Default:
callback - This forms the final section of the callback URL from authentication provider,
ie.
http://example.org/auth/strategy/callback
- Default:
HTTP clients¶
- cURL
- Uses cURL for making of HTTP calls.
- Requires
php_curl - Default client. Zero configuration needed.
- File
- Uses
file_get_contents()for making of HTTP calls. - Requires allow_url_fopen to be enabled.
- To use, set
http_clienttoOpauth\\Opauth\\HttpClient\\File
- Uses
- Guzzle version 4
- Uses latest stable version of Guzzle for making HTTP calls.
- Recommended HTTP client for Opauth
- Not set as default for Opauth due to minimum PHP requirement being >= 5.4.2.
- To use:
1. Composer require
guzzlehttp/guzzle:~4.01. sethttp_clienttoOpauth\\Opauth\\HttpClient\\Guzzle
- Guzzle version 3
- Uses Guzzle version 3 for making HTTP calls.
- To use:
1. Composer require
guzzle/guzzle:~3.71. sethttp_clienttoOpauth\\Opauth\\HttpClient\\Guzzle3
Opauth HTTP client is extensible. You can author your own desired clients if you wish.
Strategy configuration¶
Each strategy has its own configuration keys. Check the strategy README file for more information.
The strategies should be configured in the 'Strategy' key in the config array, each under its own key that matches
the classname of the strategy.
More info...