MediaWiki OAuth client.
More...
|
| __construct (ClientConfig $config, LoggerInterface $logger=null) |
|
| setLogger (LoggerInterface $logger) |
| @inheritDoc
|
|
| setExtraParam ( $key, $value) |
| Set an extra param in the call that need to be signed.
|
|
| setExtraParams (array $params) |
|
| setCallback ( $url) |
| Set callback URL for OAuth handshake.
|
|
| initiate () |
| First part of 3-legged OAuth, get the request Token.
|
|
| complete (Token $requestToken, $verifyCode) |
| The final leg of the OAuth handshake.
|
|
| identify (Token $accessToken) |
| Optional step.
|
|
| makeOAuthCall ($token, $url, $isPost=false, array $postFields=null) |
| Make a signed request to MediaWiki.
|
|
|
| validateJWT ( $identity, $consumerKey, $expectedConnonicalServer, $nonce) |
|
◆ __construct()
MediaWiki\OAuthClient\Client::__construct |
( |
ClientConfig |
$config, |
|
|
LoggerInterface |
$logger = null |
|
) |
| |
- Parameters
-
ClientConfig | $config | |
LoggerInterface | null | $logger | |
◆ complete()
MediaWiki\OAuthClient\Client::complete |
( |
Token |
$requestToken, |
|
|
|
$verifyCode |
|
) |
| |
The final leg of the OAuth handshake.
Exchange the request Token from initiate() and the verification code that the user submitted back to you for an access token, which you'll use for all API calls.
- Parameters
-
Token | $requestToken | Authorization code sent to the callback url |
string | $verifyCode | Temp/request token obtained from initiate, or null if this object was used and the token is already set. |
- Returns
- Token The access token
- Exceptions
-
Exception | On failed handshakes |
◆ identify()
MediaWiki\OAuthClient\Client::identify |
( |
Token |
$accessToken | ) |
|
Optional step.
This call the MediaWiki specific /identify method, which returns a signed statement of the authorizing user's identity. Use this if you are authenticating users in your application, and you need to know their username, groups, rights, etc in MediaWiki.
- Parameters
-
Token | $accessToken | Access token from complete() |
- Returns
- stdClass An object containing attributes of the user
- Exceptions
-
Exception | On malformed server response or invalid JWT |
◆ initiate()
MediaWiki\OAuthClient\Client::initiate |
( |
| ) |
|
First part of 3-legged OAuth, get the request Token.
Redirect your authorizing users to the redirect url, and keep track of the request token since you need to pass it into complete()
- Returns
- array [redirect, request/temp token]
- Exceptions
-
Exception | When the server returns an error or a malformed response |
◆ makeOAuthCall()
MediaWiki\OAuthClient\Client::makeOAuthCall |
( |
|
$token, |
|
|
|
$url, |
|
|
|
$isPost = false , |
|
|
array |
$postFields = null |
|
) |
| |
Make a signed request to MediaWiki.
- Parameters
-
Token | $token | additional token to use in signature, besides the consumer token. In most cases, this will be the access token you got from complete(), but we set it to the request token when finishing the handshake. |
string | $url | URL to call |
bool | $isPost | true if this should be a POST request |
array | null | $postFields | POST parameters, only if $isPost is also true |
- Returns
- string Body from the curl request
- Exceptions
-
◆ newFromKeyAndSecret()
static MediaWiki\OAuthClient\Client::newFromKeyAndSecret |
( |
|
$url, |
|
|
|
$key, |
|
|
|
$secret |
|
) |
| |
|
static |
- Parameters
-
string | $url | |
string | $key | |
string | $secret | |
- Returns
- Client
◆ setCallback()
MediaWiki\OAuthClient\Client::setCallback |
( |
|
$url | ) |
|
Set callback URL for OAuth handshake.
- Parameters
-
◆ setExtraParam()
MediaWiki\OAuthClient\Client::setExtraParam |
( |
|
$key, |
|
|
|
$value |
|
) |
| |
Set an extra param in the call that need to be signed.
This should only be needed for OAuth internals.
- Parameters
-
◆ setExtraParams()
MediaWiki\OAuthClient\Client::setExtraParams |
( |
array |
$params | ) |
|
- Parameters
-
- See also
- setExtraParam
◆ validateJWT()
MediaWiki\OAuthClient\Client::validateJWT |
( |
|
$identity, |
|
|
|
$consumerKey, |
|
|
|
$expectedConnonicalServer, |
|
|
|
$nonce |
|
) |
| |
|
protected |
- Parameters
-
stdClass | $identity | |
string | $consumerKey | |
string | $expectedConnonicalServer | |
string | $nonce | |
- Returns
- bool
The documentation for this class was generated from the following file: