MediaWiki master
PasswordDomainAuthenticationRequest.php
Go to the documentation of this file.
1<?php
22namespace MediaWiki\Auth;
23
25
34 private $domainList;
35
37 public $domain = null;
38
43 public function __construct( array $domainList ) {
44 $this->domainList = $domainList;
45 }
46
51 public function getFieldInfo() {
52 $ret = parent::getFieldInfo();
53
54 // Only add a domain field if we have the username field included
55 if ( isset( $ret['username'] ) ) {
56 $ret['domain'] = [
57 'type' => 'select',
58 'options' => [],
59 'label' => wfMessage( 'yourdomainname' ),
60 'help' => wfMessage( 'authmanager-domain-help' ),
61 ];
62 foreach ( $this->domainList as $domain ) {
63 $ret['domain']['options'][$domain] = new RawMessage( '$1', [ $domain ] );
64 }
65 }
66
67 return $ret;
68 }
69
74 public function describeCredentials() {
75 return [
76 'provider' => wfMessage( 'authmanager-provider-password-domain' ),
77 'account' => wfMessage(
78 'authmanager-account-password-domain', [ $this->username, $this->domain ]
79 ),
80 ];
81 }
82
88 public static function __set_state( $data ) {
89 $ret = new static( $data['domainList'] );
90 foreach ( $data as $k => $v ) {
91 if ( $k !== 'domainList' ) {
92 $ret->$k = $v;
93 }
94 }
95 return $ret;
96 }
97}
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
This is a value object for authentication requests with a username and password.
This is a value object for authentication requests with a username, password, and domain.
getFieldInfo()
Fetch input field info.This will be used in the AuthManager APIs and web UIs to define API input para...
describeCredentials()
Describe the credentials represented by this request.This is used on requests returned by Authenticat...
Variant of the Message class.