См. определение в файле otp.php строка 19
◆ __construct()
__construct |
( |
|
$algorithm = null | ) |
|
- Аргументы
-
string | null | $algorithm | Class of needed OtpAlgorithm. |
См. определение в файле otp.php строка 65
◆ activate()
Activate user OTP OTP must be initialized (have secret, params, etc) before activate
- Возвращает
- $this
- Исключения
-
См. определение в файле otp.php строка 383
◆ canSkipByCookie()
Check if user have valid cookie for skip OTP checking ("Remember OTP on this computer")
- Возвращает
- bool
См. определение в файле otp.php строка 990
◆ canSkipMandatory()
Check if current user can skip OTP mandatory using. It can skip if:
- Otp already activated
- User never login before
- User not included to mandatory rights
- The current date is included in the window initialization
- Возвращает
- bool
См. определение в файле otp.php строка 957
◆ canSkipMandatoryByRights()
canSkipMandatoryByRights |
( |
| ) |
|
Check if current user not included to mandatory rights
- Возвращает
- bool
См. определение в файле otp.php строка 975
◆ clearGlobalCache()
Clear cache for this OTP in global scope
- Возвращает
- $this
См. определение в файле otp.php строка 1098
◆ deactivate()
Deactivate user OTP for a needed number of days or forever
- Аргументы
-
int | $days | Days. 0 means "forever". |
- Возвращает
- $this
- Исключения
-
См. определение в файле otp.php строка 403
◆ defer()
Defer mandatory user OTP using for a needed number of days or forever
- Аргументы
-
int | $days | Days. 0 means "forever". |
- Возвращает
- $this
- Исключения
-
См. определение в файле otp.php строка 433
◆ delete()
Delete OTP record from DB
- Возвращает
- $this
См. определение в файле otp.php строка 369
◆ generateLabel()
generateLabel |
( |
|
$issuer = null | ) |
|
|
protected |
Generate label, based on current host, user login and issuer (if provided)
- Аргументы
-
string | null | $issuer | Issuer. |
- Возвращает
- string
См. определение в файле otp.php строка 900
◆ getAppSecret()
Return mobile application secret, using for manual device initialization
- Возвращает
- string
См. определение в файле otp.php строка 717
◆ getAttempts()
Return verifying attempts count
- Возвращает
- int
См. определение в файле otp.php строка 661
◆ getAvailableTypes()
static getAvailableTypes |
( |
| ) |
|
|
static |
Return available OtpAlgorithm types
- Возвращает
- array
См. определение в файле otp.php строка 1456
◆ getByType()
static getByType |
( |
|
$type | ) |
|
|
static |
Return new instance with needed OtpAlgorithm type
- Аргументы
-
string | $type | Type of OtpAlgorithm (see getAvailableTypes). |
- Исключения
-
Bitrix\Main\ArgumentOutOfRangeException
- Возвращает
- static New instance
См. определение в файле otp.php строка 128
◆ getByUser()
static getByUser |
( |
|
$userId | ) |
|
|
static |
Return new instance for user provided by user ID
- Аргументы
-
- Исключения
-
ArgumentOutOfRangeException | |
ArgumentTypeException | |
- Возвращает
- static New instance, if user does not use OTP - returning NullObject (see Otp::isActivated).
См. определение в файле otp.php строка 85
◆ getContext()
Returns context of the current request.
- Возвращает
- \Bitrix\Main\Context
См. определение в файле otp.php строка 821
◆ getDeactivateUntil()
- Возвращает
- Type\DateTime
См. определение в файле otp.php строка 528
◆ getDefaultIssuer()
Return default issuer
- Возвращает
- string
См. определение в файле otp.php строка 881
◆ getDefaultType()
static getDefaultType |
( |
| ) |
|
|
static |
Return default OtpAlgorithm type
- Возвращает
- string
См. определение в файле otp.php строка 1446
◆ getDeferredParams()
static getDeferredParams |
( |
| ) |
|
|
static |
Return deferred params (see verifyUser)
- Возвращает
- array|null
См. определение в файле otp.php строка 1322
◆ getHexSecret()
Return hex-encoded secret
- Возвращает
- string
См. определение в файле otp.php строка 705
◆ getInitialDate()
Returns OTP initialization date
- Возвращает
- Type\DateTime
См. определение в файле otp.php строка 507
◆ getInitialTimestamp()
Returns Unix timestamp of OTP initialization date
- Возвращает
- int
См. определение в файле otp.php строка 561
◆ getIssuer()
Return issuer. If custom issuer not available - return default (see getDefaultIssuer).
- Возвращает
- string
См. определение в файле otp.php строка 769
◆ getLabel()
getLabel |
( |
|
$issuer = null | ) |
|
Return label for issuer (if provided) If custom label not available - generate default (see generateLabel)
- Аргументы
-
string | null | $issuer | Issuer. |
- Возвращает
- string
См. определение в файле otp.php строка 796
◆ getMandatoryRights()
static getMandatoryRights |
( |
| ) |
|
|
static |
Return user rights who must use OTP in mandatory way
- Возвращает
- array
См. определение в файле otp.php строка 1415
◆ getMaxLoginAttempts()
Return maximum verifying attempts, based on security group policy
- Возвращает
- int
См. определение в файле otp.php строка 913
◆ getParams()
Return user params (e.g. counter for HotpAlgorithm)
- Возвращает
- string
См. определение в файле otp.php строка 685
◆ getPolicy()
Return needed group security policy
- Возвращает
- Policy\RulesCollection
См. определение в файле otp.php строка 1083
◆ getProvisioningUri()
getProvisioningUri |
( |
array |
$opts = array() | ) |
|
◆ getRememberIpMask()
Return IP mask for checks remember value
- Возвращает
- string
См. определение в файле otp.php строка 939
◆ getRememberLifetime()
Return how long (in sec)remember value are valid
- Возвращает
- int
См. определение в файле otp.php строка 926
◆ getSecret()
Return binary secret
- Возвращает
- string
См. определение в файле otp.php строка 695
◆ getSkipCookieValue()
Generate skip value for save in cookies Currently based on client IP and mask (see getRememberIpMask)
- Возвращает
- string
См. определение в файле otp.php строка 1021
◆ getSkipMandatoryDays()
static getSkipMandatoryDays |
( |
| ) |
|
|
static |
Return initialization window (in days) for mandatory using checking
- Возвращает
- int
См. определение в файле otp.php строка 1373
◆ getSyncParameters()
getSyncParameters |
( |
|
$inputA, |
|
|
|
$inputB |
|
) |
| |
Return synchronized user params for provided inputs
- Аргументы
-
string | $inputA | First code. |
string | $inputB | Second code. |
- Исключения
-
Bitrix\Main\Security\OtpException
- Возвращает
- string
См. определение в файле otp.php строка 274
◆ getType()
Return used OtpAlgorithm type
- Возвращает
- string
См. определение в файле otp.php строка 162
◆ getTypesDescription()
static getTypesDescription |
( |
| ) |
|
|
static |
Return available OtpAlgorithm types description
- Возвращает
- array
См. определение в файле otp.php строка 1466
◆ getUserId()
Return used User ID
- Возвращает
- int
См. определение в файле otp.php строка 588
◆ getUserLogin()
Return user login If custom login not available it will be fetched from DB
- Возвращает
- string
См. определение в файле otp.php строка 860
◆ isActivated()
Return is OTP activated or not
- Возвращает
- bool
См. определение в файле otp.php строка 611
◆ isAttemptsReached()
Check is verifying attempts reached according to group security policy May be used for show Captcha or what ever you want
- Возвращает
- bool
См. определение в файле otp.php строка 256
◆ isCaptchaRequired()
static isCaptchaRequired |
( |
| ) |
|
|
static |
Return if user must provide captcha code before checking OTP password
- Возвращает
- bool
См. определение в файле otp.php строка 1306
◆ isDbRecordExists()
Check if OTP record exists in DB
- Возвращает
- bool
См. определение в файле otp.php строка 1073
◆ isInitialized()
- Возвращает
- bool
См. определение в файле otp.php строка 631
◆ isMandatorySkipped()
Returns true if user can skip mandatory using
- Возвращает
- bool
См. определение в файле otp.php строка 551
◆ isMandatoryUsing()
static isMandatoryUsing |
( |
| ) |
|
|
static |
Return is mandatory OTP using activated
- Возвращает
- bool
См. определение в файле otp.php строка 1394
◆ isOtpEnabled()
Returns if OTP enabled
- Возвращает
- bool
См. определение в файле otp.php строка 1487
◆ isOtpRequired()
Returns true if user must provide password from device
- Возвращает
- bool
См. определение в файле otp.php строка 1277
◆ isOtpRequiredByMandatory()
static isOtpRequiredByMandatory |
( |
| ) |
|
|
static |
Returns true if user doesn't use OTP, but it required and grace full period ends
- Возвращает
- bool
См. определение в файле otp.php строка 1287
◆ isRecoveryCodesEnabled()
static isRecoveryCodesEnabled |
( |
| ) |
|
|
static |
Returns if "Recovery codes" are enabled
- Возвращает
- bool
См. определение в файле otp.php строка 1497
◆ isUserActive()
◆ regenerate()
regenerate |
( |
|
$newSecret = null | ) |
|
Reinitialize OTP (generate new secret, set default algo, etc), must be called before connect new device
- Аргументы
-
null | $newSecret | Using custom secret. |
- Возвращает
- $this
См. определение в файле otp.php строка 205
◆ save()
Save all OTP data to DB
- Исключения
-
- Возвращает
- bool
См. определение в файле otp.php строка 324
◆ sendEvent()
static sendEvent |
( |
Otp |
$otp | ) |
|
|
staticprotected |
◆ setActive()
Set new activating state
- Аргументы
-
bool | $isActive | Otp is activated or not. |
- Возвращает
- $this
См. определение в файле otp.php строка 599
◆ setAppSecret()
Set new mobile application secret
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 756
◆ setAttempts()
setAttempts |
( |
|
$attemptsCount | ) |
|
|
protected |
Set new verifying attempts count
- Аргументы
-
int | $attemptsCount | Attempts count. |
- Возвращает
- $this
См. определение в файле otp.php строка 649
◆ setContext()
Set context of the current request.
- Аргументы
-
\Bitrix\Main\Context | $context | Application context. |
- Возвращает
- $this
См. определение в файле otp.php строка 835
◆ setDeactivateUntil()
setDeactivateUntil |
( |
|
$date | ) |
|
|
protected |
Set datetime when user OTP must activated back
- Аргументы
-
Type\DateTime | null | $date | Datetime. "null" means never. |
- Возвращает
- $this
См. определение в файле otp.php строка 518
◆ setDefaultType()
static setDefaultType |
( |
|
$value | ) |
|
|
static |
Set default OtpAlgorithm type
- Аргументы
-
string | $value | OtpAlgorithm type (see getAvailableTypes). |
- Исключения
-
ArgumentOutOfRangeException | |
- Возвращает
- void
См. определение в файле otp.php строка 1432
◆ setDeferredParams()
static setDeferredParams |
( |
|
$params | ) |
|
|
static |
Set or delete deferred params (see verifyUser)
- Аргументы
-
array | null | $params | Params, null means deleting params from storage. |
- Возвращает
- void
См. определение в файле otp.php строка 1339
◆ setHexSecret()
setHexSecret |
( |
|
$hexValue | ) |
|
Set new secret in hex-encoded representation
- Аргументы
-
string | $hexValue | Hex-encoded secret. |
- Возвращает
- $this
См. определение в файле otp.php строка 743
◆ setInitialDate()
Set new OTP initialization date
- Аргументы
-
Type\DateTime | $date | Initialization date. |
- Возвращает
- $this
См. определение в файле otp.php строка 495
◆ setIssuer()
Set custom issuer
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 783
◆ setLabel()
Set custom label
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 810
◆ setMandatoryRights()
static setMandatoryRights |
( |
array |
$rights | ) |
|
|
static |
Set user rights who must use OTP in mandatory way
- Аргументы
-
array | $rights | Needed rights. E.g. ['G1'] for administrators. |
- Возвращает
- void
См. определение в файле otp.php строка 1405
◆ setMandatoryUsing()
static setMandatoryUsing |
( |
|
$isMandatory = true | ) |
|
|
static |
Activate or deactivate mandatory OTP using
- Аргументы
-
bool | $isMandatory | Active or not. |
- Возвращает
- void
См. определение в файле otp.php строка 1384
◆ setParams()
Set new user params (e.g. counter for HotpAlgorithm)
- См. также
- getSyncParameters
- Аргументы
-
string | $params | User params. |
- Возвращает
- $this
См. определение в файле otp.php строка 673
◆ setSecret()
Set new secret
- Аргументы
-
string | $secret | Binary secret. |
- Возвращает
- $this
См. определение в файле otp.php строка 731
◆ setSkipCookie()
Store new value for skip OTP checking ("Remember OTP on this computer") in cookies
- Возвращает
- $this
@global \CMain $APPLICATION
См. определение в файле otp.php строка 1034
◆ setSkipMandatory()
setSkipMandatory |
( |
|
$isSkipped = true | ) |
|
|
protected |
Set if user allowed to bypass OTP mandatory using while authorization
- Аргументы
-
bool | $isSkipped | Allowed or not. |
- Возвращает
- $this
См. определение в файле otp.php строка 539
◆ setSkipMandatoryDays()
static setSkipMandatoryDays |
( |
|
$days = 2 | ) |
|
|
static |
Set initialization window (in days) for mandatory using checking
- Аргументы
-
int | $days | Days of initialization window. "0" means immediately (on next user authorization). |
- Возвращает
- void
См. определение в файле otp.php строка 1363
◆ setType()
Set new type of OtpAlgorithm
- Аргументы
-
string | $type | Type of OtpAlgorithm (see getAvailableTypes). |
- Исключения
-
ArgumentOutOfRangeException | |
- Возвращает
- $this
См. определение в файле otp.php строка 146
◆ setUserActive()
setUserActive |
( |
|
$isActive | ) |
|
◆ setUserId()
Set new User ID
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 576
◆ setUserInfo()
setUserInfo |
( |
array |
$userInfo | ) |
|
Set new user information Mostly used for initialization from DB Now support:
- ACTIVE: bool, activating state (see setActive)
- USER_ID: integer, User ID (see setUserId)
- ATTEMPTS: integer, Attempts counter (see setAttempts)
- SECRET: binary, User secret (see setSecret)
- PARAMS: string, User params (see setParams and getSyncParameters)
- INITIAL_DATE: Type\Date, OTP initial date (see setInitialDate)
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 468
◆ setUserLogin()
Set custom user login
- Аргументы
-
- Возвращает
- $this
См. определение в файле otp.php строка 847
◆ syncParameters()
syncParameters |
( |
|
$inputA, |
|
|
|
$inputB = null |
|
) |
| |
Synchronize user params for provided inputs Must be called after regenerate and before save! If something went wrong - throw OtpException with valid description in message
- Аргументы
-
string | $inputA | First code. |
string | null | $inputB | Second code. |
- Исключения
-
- Возвращает
- $this
См. определение в файле otp.php строка 289
◆ verify()
verify |
( |
|
$input, |
|
|
|
$updateParams = true |
|
) |
| |
Verify provided input
- Аргументы
-
string | $input | Input received from user. |
bool | $updateParams | Update or not user parameters in DB (e.g. counter for HotpAlgorithm). |
- Возвращает
- bool True if input is valid.
См. определение в файле otp.php строка 232
◆ verifyUser()
static verifyUser |
( |
array |
$params | ) |
|
|
static |
Most complex method, can check everything:-) ToDo: describe after refactoring
- Аргументы
-
array | $params | Event parameters. |
- Возвращает
- bool
См. определение в файле otp.php строка 1114
◆ $active
◆ $algorithmClass
◆ $attempts
◆ $availableTypes
$availableTypes = array(self::TYPE_HOTP, self::TYPE_TOTP) |
|
staticprotected |
◆ $context
◆ $deactivateUntil
◆ $initialDate
◆ $issuer
◆ $label
◆ $params
◆ $regenerated
◆ $secret
◆ $skipMandatory
◆ $type
◆ $typeMap
Инициализатор= array(
self::TYPE_HOTP => '\Bitrix\Main\Security\Mfa\HotpAlgorithm',
self::TYPE_TOTP => '\Bitrix\Main\Security\Mfa\TotpAlgorithm',
)
См. определение в файле otp.php строка 35
◆ $userActive
◆ $userGroupPolicy
◆ $userId
◆ $userLogin
◆ REJECT_BY_CODE
const REJECT_BY_CODE = 'code' |
◆ REJECT_BY_MANDATORY
const REJECT_BY_MANDATORY = 'mandatory' |
◆ REJECTED_KEY
const REJECTED_KEY = 'OTP_REJECT_REASON' |
◆ SECRET_LENGTH
◆ SKIP_COOKIE
const SKIP_COOKIE = 'OTPH' |
◆ TAGGED_CACHE_TEMPLATE
const TAGGED_CACHE_TEMPLATE = 'USER_OTP_%d' |
◆ TYPE_DEFAULT
const TYPE_DEFAULT = self::TYPE_HOTP |
◆ TYPE_HOTP
◆ TYPE_TOTP