MediaWiki REL1_34
MediaWiki\Extension\OATHAuth\OATHUser Class Reference

Class representing a user from OATH's perspective. More...

Collaboration diagram for MediaWiki\Extension\OATHAuth\OATHUser:

Public Member Functions

 __construct (User $user, $keys=[])
 Constructor.
 
 addKey (IAuthKey $key)
 Adds single key to the key array.
 
 clearAllKeys ()
 Removes all keys associated with the user Warning: This only removes the keys in memory, changes need to be persisted.
 
 disable ()
 Disables current (if any) auth method.
 
 getAccount ()
 
 getFirstKey ()
 Useful for modules that operate on single-key premise, as well as testing the key type, since first key is necessarily the same type as others.
 
 getIssuer ()
 
 getKeys ()
 Get the key associated with this user.
 
 getModule ()
 Gets the module instance associated with this user.
 
 getUser ()
 
 setKeys ( $keys=[])
 Set the key associated with this user.
 
 setModule (IModule $module=null)
 Sets the module instance associated with this user.
 

Private Member Functions

 keyTypeCorrect (IAuthKey $key)
 All keys set for the user must be of the same type.
 

Private Attributes

IAuthKey[] $keys
 
IModule $module
 
User $user
 

Detailed Description

Class representing a user from OATH's perspective.

Definition at line 28 of file OATHUser.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Extension\OATHAuth\OATHUser::__construct ( User $user,
$keys = [] )

Constructor.

Can't be called directly. Use OATHUserRepository::findByUser instead.

Parameters
User$user
IAuthKey[]$keys

Definition at line 45 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\$user, and MediaWiki\Extension\OATHAuth\OATHUser\setKeys().

Member Function Documentation

◆ addKey()

MediaWiki\Extension\OATHAuth\OATHUser::addKey ( IAuthKey $key)

Adds single key to the key array.

Parameters
IAuthKey$key

Definition at line 127 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\keyTypeCorrect().

Referenced by MediaWiki\Extension\OATHAuth\OATHUser\setKeys(), and MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().

◆ clearAllKeys()

MediaWiki\Extension\OATHAuth\OATHUser::clearAllKeys ( )

Removes all keys associated with the user Warning: This only removes the keys in memory, changes need to be persisted.

Definition at line 118 of file OATHUser.php.

◆ disable()

MediaWiki\Extension\OATHAuth\OATHUser::disable ( )

Disables current (if any) auth method.

Definition at line 156 of file OATHUser.php.

◆ getAccount()

MediaWiki\Extension\OATHAuth\OATHUser::getAccount ( )
Returns
String

Definition at line 72 of file OATHUser.php.

Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().

◆ getFirstKey()

MediaWiki\Extension\OATHAuth\OATHUser::getFirstKey ( )

Useful for modules that operate on single-key premise, as well as testing the key type, since first key is necessarily the same type as others.

Returns
IAuthKey|null

Definition at line 92 of file OATHUser.php.

Referenced by MediaWiki\Extension\OATHAuth\Module\TOTP\getDataFromUser(), MediaWiki\Extension\OATHAuth\Module\TOTP\isEnabled(), and MediaWiki\Extension\OATHAuth\Module\TOTP\verify().

◆ getIssuer()

MediaWiki\Extension\OATHAuth\OATHUser::getIssuer ( )
Returns
String

Definition at line 60 of file OATHUser.php.

References $wgSitename.

◆ getKeys()

MediaWiki\Extension\OATHAuth\OATHUser::getKeys ( )

Get the key associated with this user.

Returns
IAuthKey[]|array

Definition at line 81 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\$keys.

◆ getModule()

MediaWiki\Extension\OATHAuth\OATHUser::getModule ( )

Gets the module instance associated with this user.

Returns
IModule

Definition at line 140 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\$module.

Referenced by MediaWiki\Extension\OATHAuth\Module\TOTP\getManageForm(), and MediaWiki\Extension\OATHAuth\OATHUserRepository\persist().

◆ getUser()

◆ keyTypeCorrect()

MediaWiki\Extension\OATHAuth\OATHUser::keyTypeCorrect ( IAuthKey $key)
private

All keys set for the user must be of the same type.

Parameters
IAuthKey$key
Returns
bool

Definition at line 167 of file OATHUser.php.

Referenced by MediaWiki\Extension\OATHAuth\OATHUser\addKey().

◆ setKeys()

MediaWiki\Extension\OATHAuth\OATHUser::setKeys ( $keys = [])

Set the key associated with this user.

Parameters
IAuthKey[]$keys

Definition at line 104 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\$keys, and MediaWiki\Extension\OATHAuth\OATHUser\addKey().

Referenced by MediaWiki\Extension\OATHAuth\OATHUser\__construct().

◆ setModule()

MediaWiki\Extension\OATHAuth\OATHUser::setModule ( IModule $module = null)

Sets the module instance associated with this user.

Parameters
IModule | null$module

Definition at line 149 of file OATHUser.php.

References MediaWiki\Extension\OATHAuth\OATHUser\$module.

Referenced by MediaWiki\Extension\OATHAuth\Key\TOTPKey\verify().

Member Data Documentation

◆ $keys

IAuthKey [] MediaWiki\Extension\OATHAuth\OATHUser::$keys
private

◆ $module

IModule MediaWiki\Extension\OATHAuth\OATHUser::$module
private

◆ $user

User MediaWiki\Extension\OATHAuth\OATHUser::$user
private

The documentation for this class was generated from the following file: