mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/OATHAuth
synced 2024-11-30 19:14:31 +00:00
Remove and fix remaining phpcs exclusions
Change-Id: Ib93f4c70383e838cf28bb07a05ea5d962263d14c
This commit is contained in:
parent
659012e543
commit
1bc446c9ad
|
@ -1,9 +1,6 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<ruleset name="MediaWiki">
|
<ruleset name="MediaWiki">
|
||||||
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki">
|
<rule ref="./vendor/mediawiki/mediawiki-codesniffer/MediaWiki" />
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationProtected" />
|
|
||||||
<exclude name="MediaWiki.Commenting.FunctionComment.MissingDocumentationPublic" />
|
|
||||||
</rule>
|
|
||||||
<file>.</file>
|
<file>.</file>
|
||||||
<arg name="encoding" value="UTF-8" />
|
<arg name="encoding" value="UTF-8" />
|
||||||
<arg name="extensions" value="php,php5,inc,sample" />
|
<arg name="extensions" value="php,php5,inc,sample" />
|
||||||
|
|
|
@ -92,6 +92,11 @@ class ApiOATHValidate extends ApiBase {
|
||||||
$this->getResult()->addValue( null, $this->getModuleName(), $result );
|
$this->getResult()->addValue( null, $this->getModuleName(), $result );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $params
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
public function getCacheMode( $params ) {
|
public function getCacheMode( $params ) {
|
||||||
return 'private';
|
return 'private';
|
||||||
}
|
}
|
||||||
|
@ -104,6 +109,9 @@ class ApiOATHValidate extends ApiBase {
|
||||||
return 'csrf';
|
return 'csrf';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAllowedParams() {
|
public function getAllowedParams() {
|
||||||
return [
|
return [
|
||||||
'user' => [
|
'user' => [
|
||||||
|
@ -119,6 +127,9 @@ class ApiOATHValidate extends ApiBase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getExamplesMessages() {
|
protected function getExamplesMessages() {
|
||||||
return [
|
return [
|
||||||
'action=oathvalidate&totp=123456&token=123ABC'
|
'action=oathvalidate&totp=123456&token=123ABC'
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
namespace MediaWiki\Extension\OATHAuth\Api\Module;
|
namespace MediaWiki\Extension\OATHAuth\Api\Module;
|
||||||
|
|
||||||
use MediaWiki\MediaWikiServices;
|
use MediaWiki\MediaWikiServices;
|
||||||
|
use ApiQuery;
|
||||||
use ApiQueryBase;
|
use ApiQueryBase;
|
||||||
use ApiBase;
|
use ApiBase;
|
||||||
use ApiResult;
|
use ApiResult;
|
||||||
|
@ -35,6 +36,10 @@ use User;
|
||||||
* @ingroup Extensions
|
* @ingroup Extensions
|
||||||
*/
|
*/
|
||||||
class ApiQueryOATH extends ApiQueryBase {
|
class ApiQueryOATH extends ApiQueryBase {
|
||||||
|
/**
|
||||||
|
* @param ApiQuery $query
|
||||||
|
* @param string $moduleName
|
||||||
|
*/
|
||||||
public function __construct( $query, $moduleName ) {
|
public function __construct( $query, $moduleName ) {
|
||||||
parent::__construct( $query, $moduleName, 'oath' );
|
parent::__construct( $query, $moduleName, 'oath' );
|
||||||
}
|
}
|
||||||
|
@ -81,6 +86,9 @@ class ApiQueryOATH extends ApiQueryBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getAllowedParams() {
|
public function getAllowedParams() {
|
||||||
return [
|
return [
|
||||||
'user' => [
|
'user' => [
|
||||||
|
@ -89,6 +97,9 @@ class ApiQueryOATH extends ApiQueryBase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getExamplesMessages() {
|
protected function getExamplesMessages() {
|
||||||
return [
|
return [
|
||||||
'action=query&meta=oath'
|
'action=query&meta=oath'
|
||||||
|
|
|
@ -36,6 +36,9 @@ class TOTPAuthenticationRequest extends AuthenticationRequest {
|
||||||
] + parent::describeCredentials();
|
] + parent::describeCredentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
public function getFieldInfo() {
|
public function getFieldInfo() {
|
||||||
return [
|
return [
|
||||||
'OATHToken' => [
|
'OATHToken' => [
|
||||||
|
|
|
@ -101,6 +101,9 @@ abstract class OATHAuthOOUIHTMLForm extends OOUIHTMLForm implements IManageForm
|
||||||
return LoggerFactory::getInstance( 'authentication' );
|
return LoggerFactory::getInstance( 'authentication' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
|
protected function wrapFieldSetSection( $legend, $section, $attributes, $isRoot ) {
|
||||||
// to get a user visible effect, wrap the fieldset into a framed panel layout
|
// to get a user visible effect, wrap the fieldset into a framed panel layout
|
||||||
$layout = new PanelLayout( array_merge( [
|
$layout = new PanelLayout( array_merge( [
|
||||||
|
|
|
@ -15,6 +15,9 @@ class TOTPDisableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
|
||||||
$this->getOutput()->addWikiMsg( 'oathauth-disabledoath' );
|
$this->getOutput()->addWikiMsg( 'oathauth-disabledoath' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getDescriptors() {
|
protected function getDescriptors() {
|
||||||
return [
|
return [
|
||||||
'token' => [
|
'token' => [
|
||||||
|
|
|
@ -26,6 +26,9 @@ class TOTPEnableForm extends OATHAuthOOUIHTMLForm implements IManageForm {
|
||||||
$this->getOutput()->addWikiMsg( 'oathauth-validatedoath' );
|
$this->getOutput()->addWikiMsg( 'oathauth-validatedoath' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
protected function getDescriptors() {
|
protected function getDescriptors() {
|
||||||
$keyData = $this->getRequest()->getSessionData( 'oathauth_totp_key' ) ?? [];
|
$keyData = $this->getRequest()->getSessionData( 'oathauth_totp_key' ) ?? [];
|
||||||
$key = TOTPKey::newFromArray( $keyData );
|
$key = TOTPKey::newFromArray( $keyData );
|
||||||
|
|
|
@ -8,6 +8,7 @@ use OOUI\HorizontalLayout;
|
||||||
use OOUI\LabelWidget;
|
use OOUI\LabelWidget;
|
||||||
use OOUI\ButtonWidget;
|
use OOUI\ButtonWidget;
|
||||||
use SpecialPage;
|
use SpecialPage;
|
||||||
|
use User;
|
||||||
|
|
||||||
class AuthModule {
|
class AuthModule {
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +25,7 @@ class AuthModule {
|
||||||
protected $preferences;
|
protected $preferences;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \User $user
|
* @param User $user
|
||||||
* @param array &$preferences
|
* @param array &$preferences
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +35,11 @@ class AuthModule {
|
||||||
return $handler->execute();
|
return $handler->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param OATHUserRepository $userRepo
|
||||||
|
* @param User $user
|
||||||
|
* @param array &$preferences
|
||||||
|
*/
|
||||||
protected function __construct( $userRepo, $user, &$preferences ) {
|
protected function __construct( $userRepo, $user, &$preferences ) {
|
||||||
$this->userRepo = $userRepo;
|
$this->userRepo = $userRepo;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
|
|
|
@ -14,6 +14,7 @@ use MediaWiki\Extension\OATHAuth\Special\OATHManage;
|
||||||
use MWException;
|
use MWException;
|
||||||
use MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm;
|
use MediaWiki\Extension\OATHAuth\HTMLForm\TOTPEnableForm;
|
||||||
use MediaWiki\Extension\OATHAuth\Auth\TOTPSecondaryAuthenticationProvider;
|
use MediaWiki\Extension\OATHAuth\Auth\TOTPSecondaryAuthenticationProvider;
|
||||||
|
use Message;
|
||||||
|
|
||||||
class TOTP implements IModule {
|
class TOTP implements IModule {
|
||||||
public static function factory() {
|
public static function factory() {
|
||||||
|
@ -28,6 +29,9 @@ class TOTP implements IModule {
|
||||||
return "totp";
|
return "totp";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Message
|
||||||
|
*/
|
||||||
public function getDisplayName() {
|
public function getDisplayName() {
|
||||||
return wfMessage( 'oathauth-module-totp-label' );
|
return wfMessage( 'oathauth-module-totp-label' );
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,9 @@ class DisableOATHForUser extends FormSpecialPage {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
protected function getLoginSecurityLevel() {
|
protected function getLoginSecurityLevel() {
|
||||||
return $this->getName();
|
return $this->getName();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue