mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-23 07:39:51 +00:00
fix
Signed-off-by: liuziwei <liuziwei12@huawei.com> Change-Id: I460433dc96f94cc987055f14851f612e6c848c7f
This commit is contained in:
parent
e4e27377a2
commit
56bc173712
@ -51,8 +51,8 @@ UserAuthResultCode AuthInstanceV9::GetAvailableStatus(napi_env env, napi_callbac
|
||||
IAM_LOGE("napi_get_value_int32 fail:%{public}d", ret);
|
||||
return UserAuthResultCode::GENERAL_ERROR;
|
||||
}
|
||||
if (!UserAuthNapiHelper::CheckAuthType(type)) {
|
||||
IAM_LOGE("CheckAuthType fail");
|
||||
if (!UserAuthNapiHelper::CheckUserAuthType(type)) {
|
||||
IAM_LOGE("CheckUserAuthType fail");
|
||||
return UserAuthResultCode::TYPE_NOT_SUPPORT;
|
||||
}
|
||||
uint32_t level;
|
||||
|
@ -65,8 +65,6 @@ private:
|
||||
std::shared_ptr<ContextCallback> GetAuthContextCallback(const AuthParam &authParam,
|
||||
const WidgetParam &widgetParam, sptr<UserAuthCallbackInterface> &callback);
|
||||
bool CheckAuthTrustLevel(AuthTrustLevel authTrustLevel);
|
||||
ResultCode CheckNorthPermission(AuthType authType);
|
||||
ResultCode CheckServicePermission(AuthType authType);
|
||||
bool CheckSingeFaceOrFinger(const std::vector<AuthType> &authType);
|
||||
int32_t CheckAuthWidgetType(const std::vector<AuthType> &authType);
|
||||
int32_t CheckAuthWidgetParam(
|
||||
|
@ -128,10 +128,14 @@ bool UserAuthService::CheckAuthTrustLevel(AuthTrustLevel authTrustLevel)
|
||||
int32_t UserAuthService::GetAvailableStatus(int32_t apiVersion, AuthType authType, AuthTrustLevel authTrustLevel)
|
||||
{
|
||||
IAM_LOGI("start");
|
||||
ResultCode checkRet = CheckServicePermission(authType);
|
||||
if (checkRet != SUCCESS) {
|
||||
if (!IpcCommon::CheckPermission(*this, ACCESS_USER_AUTH_INTERNAL_PERMISSION) &&
|
||||
!IpcCommon::CheckPermission(*this, ACCESS_BIOMETRIC_PERMISSION)) {
|
||||
IAM_LOGE("failed to check permission");
|
||||
return checkRet;
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
}
|
||||
if (apiVersion <= API_VERSION_8 && authType == PIN) {
|
||||
IAM_LOGE("authType not support");
|
||||
return TYPE_NOT_SUPPORT;
|
||||
}
|
||||
if (!CheckAuthTrustLevel(authTrustLevel)) {
|
||||
IAM_LOGE("authTrustLevel is not in correct range");
|
||||
@ -257,23 +261,6 @@ void UserAuthService::SetProperty(int32_t userId, AuthType authType, const Attri
|
||||
callback->OnSetExecutorPropertyResult(result);
|
||||
}
|
||||
|
||||
ResultCode UserAuthService::CheckNorthPermission(AuthType authType)
|
||||
{
|
||||
if (!IpcCommon::CheckPermission(*this, ACCESS_BIOMETRIC_PERMISSION)) {
|
||||
IAM_LOGE("CheckNorthPermission failed, no permission");
|
||||
return CHECK_PERMISSION_FAILED;
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
ResultCode UserAuthService::CheckServicePermission(AuthType authType)
|
||||
{
|
||||
if (IpcCommon::CheckPermission(*this, ACCESS_USER_AUTH_INTERNAL_PERMISSION)) {
|
||||
return SUCCESS;
|
||||
}
|
||||
return CheckNorthPermission(authType);
|
||||
}
|
||||
|
||||
std::shared_ptr<ContextCallback> UserAuthService::GetAuthContextCallback(const std::vector<uint8_t> &challenge,
|
||||
AuthType authType, AuthTrustLevel authTrustLevel, sptr<UserAuthCallbackInterface> &callback)
|
||||
{
|
||||
@ -305,10 +292,14 @@ uint64_t UserAuthService::Auth(int32_t apiVersion, const std::vector<uint8_t> &c
|
||||
return BAD_CONTEXT_ID;
|
||||
}
|
||||
Attributes extraInfo;
|
||||
ResultCode checkRet = CheckNorthPermission(authType);
|
||||
if (checkRet != SUCCESS) {
|
||||
IAM_LOGE("CheckNorthPermission failed");
|
||||
contextCallback->OnResult(checkRet, extraInfo);
|
||||
if (!IpcCommon::CheckPermission(*this, ACCESS_BIOMETRIC_PERMISSION)) {
|
||||
IAM_LOGE("failed to check permission");
|
||||
contextCallback->OnResult(CHECK_PERMISSION_FAILED, extraInfo);
|
||||
return BAD_CONTEXT_ID;
|
||||
}
|
||||
if (authType == PIN) {
|
||||
IAM_LOGE("authType not support");
|
||||
contextCallback->OnResult(TYPE_NOT_SUPPORT, extraInfo);
|
||||
return BAD_CONTEXT_ID;
|
||||
}
|
||||
int32_t userId;
|
||||
|
Loading…
Reference in New Issue
Block a user