Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
63.64% covered (warning)
63.64%
7 / 11
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
TOTPAuthenticationRequest
63.64% covered (warning)
63.64%
7 / 11
50.00% covered (danger)
50.00%
1 / 2
2.19
0.00% covered (danger)
0.00%
0 / 1
 describeCredentials
0.00% covered (danger)
0.00%
0 / 4
0.00% covered (danger)
0.00%
0 / 1
2
 getFieldInfo
100.00% covered (success)
100.00%
7 / 7
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2/**
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
17 */
18
19namespace MediaWiki\Extension\OATHAuth\Auth;
20
21use MediaWiki\Auth\AuthenticationRequest;
22use MediaWiki\Language\RawMessage;
23
24/**
25 * AuthManager value object for the TOTP second factor of an authentication:
26 * a pseudorandom token that is generated from the current time independently
27 * by the server and the client.
28 */
29class TOTPAuthenticationRequest extends AuthenticationRequest {
30    /** @var string */
31    public $OATHToken;
32
33    public function describeCredentials() {
34        return [
35            'provider' => wfMessage( 'oathauth-describe-provider' ),
36            'account' => new RawMessage( '$1', [ $this->username ] ),
37        ] + parent::describeCredentials();
38    }
39
40    /**
41     * @return array
42     */
43    public function getFieldInfo() {
44        return [
45            'OATHToken' => [
46                'type' => 'string',
47                'label' => wfMessage( 'oathauth-auth-token-label' ),
48                'help' => wfMessage( 'oathauth-auth-token-help' )
49            ]
50        ];
51    }
52}