mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-26 17:31:26 +00:00
!1134 any app auth result reuse
Merge pull request !1134 from 陈伟健/master
This commit is contained in:
commit
044fbd29eb
@ -897,11 +897,21 @@ napi_value ReuseModeConstructor(napi_env env)
|
||||
napi_value reuseMode = nullptr;
|
||||
napi_value auth_type_relevant = nullptr;
|
||||
napi_value auth_type_irrelevant = nullptr;
|
||||
napi_value caller_irrelevant_auth_type_relevant = nullptr;
|
||||
napi_value caller_irrelevant_auth_type_irrelevant = nullptr;
|
||||
NAPI_CALL(env, napi_create_object(env, &reuseMode));
|
||||
NAPI_CALL(env, napi_create_int32(env, ReuseMode::AUTH_TYPE_RELEVANT, &auth_type_relevant));
|
||||
NAPI_CALL(env, napi_create_int32(env, ReuseMode::AUTH_TYPE_IRRELEVANT, &auth_type_irrelevant));
|
||||
NAPI_CALL(env, napi_create_int32(
|
||||
env, ReuseMode::CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT, &caller_irrelevant_auth_type_relevant));
|
||||
NAPI_CALL(env, napi_create_int32(
|
||||
env, ReuseMode::CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT, &caller_irrelevant_auth_type_irrelevant));
|
||||
NAPI_CALL(env, napi_set_named_property(env, reuseMode, "AUTH_TYPE_RELEVANT", auth_type_relevant));
|
||||
NAPI_CALL(env, napi_set_named_property(env, reuseMode, "AUTH_TYPE_IRRELEVANT", auth_type_irrelevant));
|
||||
NAPI_CALL(env, napi_set_named_property(
|
||||
env, reuseMode, "CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT", caller_irrelevant_auth_type_relevant));
|
||||
NAPI_CALL(env, napi_set_named_property(
|
||||
env, reuseMode, "CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT", caller_irrelevant_auth_type_irrelevant));
|
||||
return reuseMode;
|
||||
}
|
||||
|
||||
|
@ -618,7 +618,9 @@ bool UserAuthNapiHelper::CheckAuthTrustLevel(uint32_t authTrustLevel)
|
||||
bool UserAuthNapiHelper::CheckReuseUnlockResult(ReuseUnlockResult reuseUnlockResult)
|
||||
{
|
||||
if (reuseUnlockResult.reuseMode != ReuseMode::AUTH_TYPE_RELEVANT &&
|
||||
reuseUnlockResult.reuseMode != ReuseMode::AUTH_TYPE_IRRELEVANT) {
|
||||
reuseUnlockResult.reuseMode != ReuseMode::AUTH_TYPE_IRRELEVANT &&
|
||||
reuseUnlockResult.reuseMode != ReuseMode::CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT &&
|
||||
reuseUnlockResult.reuseMode != ReuseMode::CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT) {
|
||||
IAM_LOGE("reuseMode check fail:%{public}u", reuseUnlockResult.reuseMode);
|
||||
return false;
|
||||
}
|
||||
|
@ -86,6 +86,12 @@ enum ReuseMode : uint32_t {
|
||||
/** Authentication type irrelevant.The unlock authentication result can be reused as long as the result is within
|
||||
* valid duration. */
|
||||
AUTH_TYPE_IRRELEVANT = 2,
|
||||
/** Caller irrelevant authentication type relevant.The unlock authentication result can be reused only when the
|
||||
* result is within valid duration as well as it comes from one of specified UserAuthTypes of the AuthParam. */
|
||||
CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT = 3,
|
||||
/** Caller irrelevant authentication type irrelevant.The unlock authentication result can be reused as long as the
|
||||
* result is within valid duration. */
|
||||
CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT = 4,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -191,7 +191,9 @@ int32_t AuthWidgetHelper::CheckReuseUnlockResult(const ContextFactory::AuthWidge
|
||||
if (!authParam.reuseUnlockResult.isReuse || authParam.reuseUnlockResult.reuseDuration == 0 ||
|
||||
authParam.reuseUnlockResult.reuseDuration > MAX_ALLOWABLE_REUSE_DURATION ||
|
||||
(authParam.reuseUnlockResult.reuseMode != AUTH_TYPE_RELEVANT &&
|
||||
authParam.reuseUnlockResult.reuseMode != AUTH_TYPE_IRRELEVANT)) {
|
||||
authParam.reuseUnlockResult.reuseMode != AUTH_TYPE_IRRELEVANT &&
|
||||
authParam.reuseUnlockResult.reuseMode != CALLER_IRRELEVANT_AUTH_TYPE_RELEVANT &&
|
||||
authParam.reuseUnlockResult.reuseMode != CALLER_IRRELEVANT_AUTH_TYPE_IRRELEVANT)) {
|
||||
IAM_LOGE("CheckReuseUnlockResult invalid param");
|
||||
return INVALID_PARAMETERS;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user