Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4145802
ClientRepository.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
ClientRepository.php
View Options
<?php
namespace
MediaWiki\Extension\OAuth\Repository
;
use
InvalidArgumentException
;
use
League\OAuth2\Server\Repositories\ClientRepositoryInterface
;
use
MediaWiki\Extension\OAuth\Backend\Utils
;
use
MediaWiki\Extension\OAuth\Entity\ClientEntity
;
class
ClientRepository
implements
ClientRepositoryInterface
{
/**
* Get a client.
*
* @param string $clientIdentifier The client's identifier
*
* @return ClientEntity|bool
*/
public
function
getClientEntity
(
$clientIdentifier
)
{
$client
=
ClientEntity
::
newFromKey
(
Utils
::
getCentralDB
(
DB_REPLICA
),
$clientIdentifier
);
if
(
!
$client
instanceof
ClientEntity
)
{
return
false
;
}
return
$client
;
}
/**
* @param int $clientId
* @return ClientEntity|bool
*/
public
function
getClientEntityByDBId
(
$clientId
)
{
$client
=
ClientEntity
::
newFromId
(
Utils
::
getCentralDB
(
DB_REPLICA
),
$clientId
);
if
(
!
$client
instanceof
ClientEntity
)
{
return
false
;
}
return
$client
;
}
/**
* Validate a client's secret.
*
* @param string $clientIdentifier The client's identifier
* @param null|string $clientSecret The client's secret (if sent)
* @param null|string $grantType The type of grant the client is using (if sent)
*
* @return bool
* @throws InvalidArgumentException
*/
public
function
validateClient
(
$clientIdentifier
,
$clientSecret
,
$grantType
)
{
$client
=
$this
->
getClientEntity
(
$clientIdentifier
);
if
(
!
$client
||
!
$client
instanceof
ClientEntity
)
{
throw
new
InvalidArgumentException
(
"Client with identifier '$clientIdentifier' does not exist!"
);
}
return
$client
->
validate
(
$clientSecret
,
$grantType
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Aug 19 2026, 17:47 (5 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
9a/66/e8c2976893546e0480bf2d0041ba
Default Alt Text
ClientRepository.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment