MediaWiki  master
PasswordDomainAuthenticationRequest.php
Go to the documentation of this file.
1 <?php
22 namespace MediaWiki\Auth;
23 
32  private $domainList;
33 
35  public $domain = null;
36 
41  public function __construct( array $domainList ) {
42  $this->domainList = $domainList;
43  }
44 
49  public function getFieldInfo() {
50  $ret = parent::getFieldInfo();
51 
52  // Only add a domain field if we have the username field included
53  if ( isset( $ret['username'] ) ) {
54  $ret['domain'] = [
55  'type' => 'select',
56  'options' => [],
57  'label' => wfMessage( 'yourdomainname' ),
58  'help' => wfMessage( 'authmanager-domain-help' ),
59  ];
60  foreach ( $this->domainList as $domain ) {
61  $ret['domain']['options'][$domain] = new \RawMessage( '$1', [ $domain ] );
62  }
63  }
64 
65  return $ret;
66  }
67 
72  public function describeCredentials() {
73  return [
74  'provider' => wfMessage( 'authmanager-provider-password-domain' ),
75  'account' => wfMessage(
76  'authmanager-account-password-domain', [ $this->username, $this->domain ]
77  ),
78  ];
79  }
80 
86  public static function __set_state( $data ) {
87  $ret = new static( $data['domainList'] );
88  foreach ( $data as $k => $v ) {
89  if ( $k !== 'domainList' ) {
90  $ret->$k = $v;
91  }
92  }
93  return $ret;
94  }
95 }
MediaWiki\Auth\PasswordDomainAuthenticationRequest\getFieldInfo
getFieldInfo()
Fetch input field info.The field info is an associative array mapping field names to info arrays....
Definition: PasswordDomainAuthenticationRequest.php:49
MediaWiki\Auth\PasswordDomainAuthenticationRequest\describeCredentials
describeCredentials()
Describe the credentials represented by this request.This is used on requests returned by Authenticat...
Definition: PasswordDomainAuthenticationRequest.php:72
MediaWiki\Auth\PasswordDomainAuthenticationRequest\__construct
__construct(array $domainList)
Definition: PasswordDomainAuthenticationRequest.php:41
wfMessage
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
Definition: GlobalFunctions.php:1182
MediaWiki\Auth\PasswordDomainAuthenticationRequest
This is a value object for authentication requests with a username, password, and domain.
Definition: PasswordDomainAuthenticationRequest.php:30
MediaWiki\Auth\PasswordDomainAuthenticationRequest\$domain
string $domain
Domain.
Definition: PasswordDomainAuthenticationRequest.php:35
MediaWiki\Auth\PasswordAuthenticationRequest
This is a value object for authentication requests with a username and password.
Definition: PasswordAuthenticationRequest.php:30
MediaWiki\Auth\PasswordDomainAuthenticationRequest\$domainList
string[] $domainList
Domains available.
Definition: PasswordDomainAuthenticationRequest.php:32
MediaWiki\Auth\PasswordDomainAuthenticationRequest\__set_state
static __set_state( $data)
Definition: PasswordDomainAuthenticationRequest.php:86
MediaWiki\Auth
Definition: AbstractAuthenticationProvider.php:22