43 if ( !isset(
$params[
'sessionCookieName'] ) ) {
44 $params[
'sessionCookieName'] =
'_BPsession';
48 if ( !isset(
$params[
'priority'] ) ) {
49 throw new \InvalidArgumentException( __METHOD__ .
': priority must be specified' );
54 throw new \InvalidArgumentException( __METHOD__ .
': Invalid priority' );
57 $this->priority =
$params[
'priority'];
62 if ( !defined(
'MW_API' ) ) {
67 if ( !$this->config->get(
'EnableBotPasswords' ) ) {
102 'persisted' => $id !== null,
110 $session = $this->
getManager()->getSessionFromInfo( $info, $request );
116 $missingKeys = array_diff(
117 [
'centralId',
'appId',
'token' ],
118 array_keys( $metadata )
120 if ( $missingKeys ) {
121 $this->logger->info(
'Session "{session}": Missing metadata: {missing}', [
123 'missing' => implode(
', ', $missingKeys ),
131 'Session "{session}": No BotPassword for {centralId} {appId}',
134 'centralId' => $metadata[
'centralId'],
135 'appId' => $metadata[
'appId'],
140 if ( !hash_equals( $metadata[
'token'], $bp->getToken() ) ) {
141 $this->logger->info(
'Session "{session}": BotPassword token check failed', [
143 'centralId' => $metadata[
'centralId'],
144 'appId' => $metadata[
'appId'],
149 $status = $bp->getRestrictions()->check( $request );
152 'Session "{session}": Restrictions check failed',
155 'restrictions' =>
$status->getValue(),
156 'centralId' => $metadata[
'centralId'],
157 'appId' => $metadata[
'appId'],
177 throw new \InvalidArgumentException(
'Backend\'s provider isn\'t $this' );
180 if ( $data && isset( $data[
'rights'] ) && is_array( $data[
'rights'] ) ) {
181 return $data[
'rights'];
185 $this->logger->debug( __METHOD__ .
': No provider metadata, returning no rights allowed' );
the array() calling protocol came about after MediaWiki 1.4rc1.
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
static getGrantRights($grants)
Fetch the rights allowed by a set of grants.
getUserCentralId()
Get the central user ID.
static newFromCentralId($centralId, $appId, $flags=self::READ_NORMAL)
Load a BotPassword from the database.
static removeAllPasswordsForUser($username)
Remove all passwords for a user, by name.
getAppId()
Get the app ID.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account $user
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
this hook is for auditing only or null if authentication failed before getting that far $username
error also a ContextSource you ll probably need to make sure the header is varied on $request
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set $status
getGrants()
Get the grants.