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
2declare( strict_types=1 );
3
4/**
5 * @license GPL-2.0-or-later
6 */
7
8namespace MediaWiki\Extension\OATHAuth\Auth;
9
10use MediaWiki\Auth\AuthenticationRequest;
11use MediaWiki\Language\RawMessage;
12
13/**
14 * AuthManager value object for the TOTP second factor of an authentication:
15 * a pseudorandom token that is generated from the current time independently
16 * by the server and the client.
17 */
18class TOTPAuthenticationRequest extends AuthenticationRequest {
19    public string $OATHToken;
20
21    /** @inheritDoc */
22    public function describeCredentials() {
23        return [
24            'provider' => wfMessage( 'oathauth-describe-provider' ),
25            'account' => new RawMessage( '$1', [ $this->username ] ),
26        ] + parent::describeCredentials();
27    }
28
29    /** @inheritDoc */
30    public function getFieldInfo() {
31        return [
32            'OATHToken' => [
33                'type' => 'string',
34                'label' => wfMessage( 'oathauth-auth-token-label' ),
35                'help' => wfMessage( 'oathauth-auth-token-help' ),
36            ]
37        ];
38    }
39}