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