mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-23 07:39:51 +00:00
any app auth result reuse
Signed-off-by: chenweijian <chenweijian16@huawei.com> Change-Id: I1b280aa14cb9e5bdcaede594405668c35197a808
This commit is contained in:
parent
16a6d9b2ab
commit
19ac27ab67
@ -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,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -185,7 +185,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