2019-06-26 02:33:35 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MediaWiki\Rest\BasicAccess;
|
|
|
|
|
|
|
|
|
|
use MediaWiki\Rest\Handler;
|
|
|
|
|
use MediaWiki\Rest\RequestInterface;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* An implementation of BasicAuthorizerInterface which creates a request-local
|
|
|
|
|
* object (a request authorizer) to do the actual authorization.
|
|
|
|
|
*
|
|
|
|
|
* @internal
|
|
|
|
|
*/
|
|
|
|
|
abstract class BasicAuthorizerBase implements BasicAuthorizerInterface {
|
|
|
|
|
public function authorize( RequestInterface $request, Handler $handler ) {
|
|
|
|
|
return $this->createRequestAuthorizer( $request, $handler )->authorize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create a BasicRequestAuthorizer to authorize the request.
|
|
|
|
|
*
|
|
|
|
|
* @param RequestInterface $request
|
|
|
|
|
* @param Handler $handler
|
|
|
|
|
* @return BasicRequestAuthorizer
|
|
|
|
|
*/
|
|
|
|
|
abstract protected function createRequestAuthorizer( RequestInterface $request,
|
2021-07-22 03:11:47 +00:00
|
|
|
Handler $handler ): BasicRequestAuthorizer;
|
2019-06-26 02:33:35 +00:00
|
|
|
}
|