Public Member Functions | |
__construct ($oauthParams=null, $tokenType=null) | |
checkConsumer ($consumerKey, $tokenKey) | |
getCallbackUrl ($tokenKey) | |
getVerifier ($tokenKey, $consumerKey) | |
lookupConsumer ($consumerKey) | |
lookupToken ($consumer, $tokenType, $token) | |
lookupNonce ($consumer, $token, $nonce, $timestamp) | |
insertNonce ($nonce, $tokenKey, $consumerKey) | |
newRequestToken ($consumer, $callback=null) | |
newAccessToken ($token, $consumer, $verifier=null) | |
insertVerifier ($verifier, $tokenKey) | |
setConsumer ($consumer, $callback=null) | |
setToken ($token, $tokenType="request") | |
getSecret ($consumerKey, $tokenKey, $secretType="consumer") | |
setAllowed ($tokenKey, $value, $userId, $expirTime, $expirTimeUnit) | |
getAllowed ($tokenKey, $consumerKey) | |
getValidUserID ($tokenKey, $consumerKey) | |
getConsumerName ($tokenKey) | |
insertUserSessionId ($userId, $sessionId, $timestamp, $ip="") | |
getUserId ($sessionId) | |
checkLogin ($user, $passwd) | |
Public Attributes | |
$consumer | |
$requestToken | |
$accessToken | |
$nonce | |
const | ERR_NO_TOKEN = 1 |
const | ERR_NO_VERIFIER = 2 |
const | ERR_NO_CALLBACK = 3 |
const | ERR_NEW_ACCESS_TOKEN = 4 |
const | ERR_NO_ALLOWED_RETRIEVED = 5 |
const | ERR_NO_USER_ID = 6 |
const | ERR_INVALID_LOGIN = 7 |
const | ERR_NO_CONSUMER = 10 |
const | ERR_NO_AUTHORIZED_CONSUMER = 11 |
const | ERR_NO_CONSUMER_NAME = 12 |
const | EXPIR_TIME_NEVER = 0 |
const | EXPIR_TIME_IN_DAYS = 1 |
const | EXPIR_TIME_IN_WEEKS = 2 |
const | EXPIR_TIME_IN_MONTHS = 3 |
const | EXPIR_TIME_IN_YEARS = 4 |
OAuthDataStore::__construct | ( | $ | oauthParams = null , |
$ | tokenType = null |
||
) |
Constructor.
array | $oauthParams | |
string | $tokenType |
OAuthDataStore::checkConsumer | ( | $ | consumerKey, |
$ | tokenKey | ||
) |
Check if the consumer exists in oauth_credentials. If so, return the credential.
string | $consumerKey | |
string | $tokenKey |
DbException |
OAuthDataStore::checkLogin | ( | $ | user, |
$ | passwd | ||
) |
Check the user and password and return the user id.
string | $user | |
string | $passwd |
DbException |
OAuthDataStore::getAllowed | ( | $ | tokenKey, |
$ | consumerKey | ||
) |
string | $tokenKey | |
string | $consumerKey |
DbException |
OAuthDataStore::getCallbackUrl | ( | $ | tokenKey | ) |
Retrieve the callback url from the db.
string | $tokenKey |
DbException |
OAuthDataStore::getConsumerName | ( | $ | tokenKey | ) |
Return the consumer name.
string | $tokenKey |
DbException |
OAuthDataStore::getSecret | ( | $ | consumerKey, |
$ | tokenKey, | ||
$ | secretType = "consumer" |
||
) |
string | $consumerKey | |
string | $tokenKey | |
string | $secretType | consumer|token |
OAuthDataStore::getUserId | ( | $ | sessionId | ) |
Return the user id giving the session id.
string | $sessionId |
OAuthDataStore::getValidUserID | ( | $ | tokenKey, |
$ | consumerKey | ||
) |
string | $tokenKey | |
string | $consumerKey |
DbException |
OAuthDataStore::getVerifier | ( | $ | tokenKey, |
$ | consumerKey | ||
) |
Retrieve the verifier code.
string | $tokenKey | |
string | $consumerKey |
DbException |
OAuthDataStore::insertNonce | ( | $ | nonce, |
$ | tokenKey, | ||
$ | consumerKey | ||
) |
This method is executed from the provider, in the request token step.
string | $nonce | |
string | $tokenKey | |
string | $consumerKey |
OAuthDataStore::insertUserSessionId | ( | $ | userId, |
$ | sessionId, | ||
$ | timestamp, | ||
$ | ip = "" |
||
) |
Insert the user id and session id in user_session table.
integer | $userId | |
string | $sessionId | |
integer | $timestamp | |
string | $ip |
OAuthDataStore::insertVerifier | ( | $ | verifier, |
$ | tokenKey | ||
) |
Insert the verification code in the db.
string | $verifier | |
string | $tokenKey |
OAuthDataStore::lookupConsumer | ( | $ | consumerKey | ) |
OAuthDataStore::lookupNonce | ( | $ | consumer, |
$ | token, | ||
$ | nonce, | ||
$ | timestamp | ||
) |
Check if a nonce has been used before, if it has not been used is stored in the db.
OAuthConsumer | $consumer | |
OAuthToken | $token | |
string | $nonce | |
string | $timestamp |
OAuthDataStore::lookupToken | ( | $ | consumer, |
$ | tokenType, | ||
$ | token | ||
) |
OAuthDataStore::newAccessToken | ( | $ | token, |
$ | consumer, | ||
$ | verifier = null |
||
) |
Create a new access token and insert it into the db.
OAuthToken | $token | |
OAuthConsumer | $consumer | |
string | $verifier |
DbException |
OAuthDataStore::newRequestToken | ( | $ | consumer, |
$ | callback = null |
||
) |
Create a new temporary token and insert it into the db.
OAuthConsumer | $consumer | |
string | $callback |
OAuthDataStore::setAllowed | ( | $ | tokenKey, |
$ | value, | ||
$ | userId, | ||
$ | expirTime, | ||
$ | expirTimeUnit | ||
) |
In the authorization step, the user allows or disallows the consumer app to access their data. If the user allows the consumer app, it's also set the expiration time in which the credential will be valid.
string | $tokenKey | |
boolean | $value | |
integer | $userId | |
integer | $expirTime | |
integer | $expirTimeUnit |
OAuthDataStore::setConsumer | ( | $ | consumer, |
$ | callback = null |
||
) |
OAuthConsumer | $consumer |
OAuthDataStore::setToken | ( | $ | token, |
$ | tokenType = "request" |
||
) |
Set any kind of token, request or access token.
OAuthToken | $token | |
string | $tokenType | request|access |
OAuthDataStore::$accessToken |
OAuthDataStore::$consumer |
OAuthDataStore::$nonce |
OAuthDataStore::$requestToken |
const OAuthDataStore::ERR_INVALID_LOGIN = 7 |
const OAuthDataStore::ERR_NEW_ACCESS_TOKEN = 4 |
const OAuthDataStore::ERR_NO_ALLOWED_RETRIEVED = 5 |
const OAuthDataStore::ERR_NO_AUTHORIZED_CONSUMER = 11 |
const OAuthDataStore::ERR_NO_CALLBACK = 3 |
const OAuthDataStore::ERR_NO_CONSUMER = 10 |
const OAuthDataStore::ERR_NO_CONSUMER_NAME = 12 |
const OAuthDataStore::ERR_NO_TOKEN = 1 |
const OAuthDataStore::ERR_NO_USER_ID = 6 |
const OAuthDataStore::ERR_NO_VERIFIER = 2 |
const OAuthDataStore::EXPIR_TIME_IN_DAYS = 1 |
const OAuthDataStore::EXPIR_TIME_IN_MONTHS = 3 |
const OAuthDataStore::EXPIR_TIME_IN_WEEKS = 2 |
const OAuthDataStore::EXPIR_TIME_IN_YEARS = 4 |
const OAuthDataStore::EXPIR_TIME_NEVER = 0 |