mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-09-23 10:23:23 +00:00
Add phan configuration
Change-Id: I80852cc4ac4ea0bff3b07b2468216eb53271e250
This commit is contained in:
parent
7451a5df33
commit
6e74fa9fba
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@
|
|||
composer.lock
|
||||
node_modules/
|
||||
vendor/
|
||||
tests/phan/issues
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
"jakub-onderka/php-parallel-lint": "1.0.0",
|
||||
"mediawiki/mediawiki-codesniffer": "17.0.0",
|
||||
"jakub-onderka/php-console-highlighter": "0.3.2",
|
||||
"mediawiki/minus-x": "0.3.1"
|
||||
"mediawiki/minus-x": "0.3.1",
|
||||
"mediawiki/mediawiki-phan-config": "0.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "parallel-lint . --exclude vendor --exclude node_modules",
|
||||
|
|
|
@ -58,6 +58,11 @@ class ApiQueryOATH extends ApiQueryBase {
|
|||
$result->addValue( 'query', $this->getModuleName(), $data );
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheMode( $params ) {
|
||||
return 'private';
|
||||
}
|
||||
|
|
|
@ -16,6 +16,12 @@ use MediaWiki\Auth\AuthManager;
|
|||
*/
|
||||
class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticationProvider {
|
||||
|
||||
/**
|
||||
* @param string $action
|
||||
* @param array $options
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAuthenticationRequests( $action, array $options ) {
|
||||
switch ( $action ) {
|
||||
case AuthManager::ACTION_LOGIN:
|
||||
|
@ -28,7 +34,11 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
|
|||
|
||||
/**
|
||||
* If the user has enabled two-factor authentication, request a second factor.
|
||||
* @inheritDoc
|
||||
*
|
||||
* @param User $user
|
||||
* @param array $reqs
|
||||
*
|
||||
* @return AuthenticationResponse
|
||||
*/
|
||||
public function beginSecondaryAuthentication( $user, array $reqs ) {
|
||||
$oathuser = OATHAuthHooks::getOATHUserRepository()->findByUser( $user );
|
||||
|
@ -54,6 +64,7 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
|
|||
}
|
||||
|
||||
$oathuser = OATHAuthHooks::getOATHUserRepository()->findByUser( $user );
|
||||
/** @suppress PhanUndeclaredProperty */
|
||||
$token = $request->OATHToken;
|
||||
|
||||
if ( $oathuser->getKey() === null ) {
|
||||
|
@ -81,6 +92,13 @@ class TOTPSecondaryAuthenticationProvider extends AbstractSecondaryAuthenticatio
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
* @param User $creator
|
||||
* @param array $reqs
|
||||
*
|
||||
* @return AuthenticationResponse
|
||||
*/
|
||||
public function beginSecondaryAccountCreation( $user, $creator, array $reqs ) {
|
||||
return AuthenticationResponse::newAbstain();
|
||||
}
|
||||
|
|
|
@ -109,6 +109,7 @@ class HOTPResult {
|
|||
protected $hash;
|
||||
protected $binary;
|
||||
protected $decimal;
|
||||
protected $hex;
|
||||
|
||||
/**
|
||||
* Build an HOTP Result
|
||||
|
|
3
tests/phan/config.php
Normal file
3
tests/phan/config.php
Normal file
|
@ -0,0 +1,3 @@
|
|||
<?php
|
||||
|
||||
return require __DIR__ . '/../../vendor/mediawiki/mediawiki-phan-config/src/config.php';
|
Loading…
Reference in a new issue