Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4140109
MockOAuthDataStore.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MockOAuthDataStore.php
View Options
<?php
namespace
MediaWiki\Extension\OAuth\Tests\Lib
;
use
MediaWiki\Extension\OAuth\Lib\OAuthConsumer
;
use
MediaWiki\Extension\OAuth\Lib\OAuthDataStore
;
use
MediaWiki\Extension\OAuth\Lib\OAuthToken
;
/**
* A mock store for testing
*/
class
MockOAuthDataStore
extends
OAuthDataStore
{
private
$consumer
;
private
$request_token
;
private
$access_token
;
private
$nonce
;
function
__construct
()
{
$this
->
consumer
=
new
OAuthConsumer
(
"key"
,
"secret"
,
NULL
);
$this
->
request_token
=
new
OAuthToken
(
"requestkey"
,
"requestsecret"
,
1
);
$this
->
access_token
=
new
OAuthToken
(
"accesskey"
,
"accesssecret"
,
1
);
$this
->
nonce
=
"nonce"
;
}
function
lookup_consumer
(
$consumer_key
)
{
if
(
$consumer_key
==
$this
->
consumer
->
key
)
return
$this
->
consumer
;
return
NULL
;
}
function
lookup_token
(
$consumer
,
$token_type
,
$token
)
{
$token_attrib
=
$token_type
.
"_token"
;
if
(
$consumer
->
key
==
$this
->
consumer
->
key
&&
$token
==
$this
->
$token_attrib
->
key
)
{
return
$this
->
$token_attrib
;
}
return
NULL
;
}
function
lookup_nonce
(
$consumer
,
$token
,
$nonce
,
$timestamp
)
{
if
(
$consumer
->
key
==
$this
->
consumer
->
key
&&
((
$token
&&
$token
->
key
==
$this
->
request_token
->
key
)
||
(
$token
&&
$token
->
key
==
$this
->
access_token
->
key
))
&&
$nonce
==
$this
->
nonce
)
{
return
$this
->
nonce
;
}
return
NULL
;
}
function
new_request_token
(
$consumer
,
$callback
=
null
)
{
if
(
$consumer
->
key
==
$this
->
consumer
->
key
)
{
return
$this
->
request_token
;
}
return
NULL
;
}
function
new_access_token
(
$token
,
$consumer
,
$verifier
=
null
)
{
if
(
$consumer
->
key
==
$this
->
consumer
->
key
&&
$token
->
key
==
$this
->
request_token
->
key
)
{
return
$this
->
access_token
;
}
return
NULL
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Wed, Aug 19, 15:20 (3 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b0/9f/509e940049e1ca6d9b5d58ffd56a
Default Alt Text
MockOAuthDataStore.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment