!80 fix UserAuth issue

Merge pull request !80 from 王国强/master
This commit is contained in:
openharmony_ci 2022-03-12 11:57:39 +00:00 committed by Gitee
commit de76c7f3f6
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
52 changed files with 234 additions and 163 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright (c) 2021 Huawei Device Co., Ltd. <!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
#include <new> #include <new>
#include <if_system_ability_manager.h> #include <if_system_ability_manager.h>
@ -54,7 +55,7 @@ sptr<IUserAuth> UserAuth::GetProxy()
proxy_ = iface_cast<IUserAuth>(obj); proxy_ = iface_cast<IUserAuth>(obj);
deathRecipient_ = dr; deathRecipient_ = dr;
USERAUTH_HILOGE(MODULE_INNERKIT, "userauth Succeed to connect userauth manager service"); USERAUTH_HILOGI(MODULE_INNERKIT, "userauth Succeed to connect userauth manager service");
return proxy_; return proxy_;
} }
@ -82,7 +83,7 @@ void UserAuth::UserAuthDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &r
} }
UserAuth::GetInstance().ResetProxy(remote); UserAuth::GetInstance().ResetProxy(remote);
USERAUTH_HILOGE(MODULE_INNERKIT, "userauth UserAuthDeathRecipient::Recv death notice."); USERAUTH_HILOGI(MODULE_INNERKIT, "userauth UserAuthDeathRecipient::Recv death notice.");
} }
int32_t UserAuth::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel) int32_t UserAuth::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel)
@ -118,6 +119,7 @@ void UserAuth::GetProperty(const GetPropertyRequest &request, std::shared_ptr<Ge
} }
proxy_->GetProperty(request, asyncStub); proxy_->GetProperty(request, asyncStub);
} }
void UserAuth::SetProperty(const SetPropertyRequest &request, std::shared_ptr<SetPropCallback> callback) void UserAuth::SetProperty(const SetPropertyRequest &request, std::shared_ptr<SetPropCallback> callback)
{ {
USERAUTH_HILOGD(MODULE_INNERKIT, "userauth SetProperty is start"); USERAUTH_HILOGD(MODULE_INNERKIT, "userauth SetProperty is start");
@ -137,6 +139,7 @@ void UserAuth::SetProperty(const SetPropertyRequest &request, std::shared_ptr<Se
} }
proxy_->SetProperty(request, asyncStub); proxy_->SetProperty(request, asyncStub);
} }
uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel, uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
std::shared_ptr<UserAuthCallback> callback) std::shared_ptr<UserAuthCallback> callback)
{ {
@ -157,6 +160,7 @@ uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const
uint64_t ret = proxy_->Auth(challenge, authType, authTurstLevel, asyncStub); uint64_t ret = proxy_->Auth(challenge, authType, authTurstLevel, asyncStub);
return ret; return ret;
} }
uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType, uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, std::shared_ptr<UserAuthCallback> callback) const AuthTurstLevel authTurstLevel, std::shared_ptr<UserAuthCallback> callback)
{ {
@ -177,6 +181,7 @@ uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, cons
uint64_t ret = proxy_->AuthUser(userId, challenge, authType, authTurstLevel, asyncStub); uint64_t ret = proxy_->AuthUser(userId, challenge, authType, authTurstLevel, asyncStub);
return ret; return ret;
} }
int32_t UserAuth::CancelAuth(const uint64_t contextId) int32_t UserAuth::CancelAuth(const uint64_t contextId)
{ {
USERAUTH_HILOGD(MODULE_INNERKIT, "userauth CancelAuth is start"); USERAUTH_HILOGD(MODULE_INNERKIT, "userauth CancelAuth is start");
@ -188,6 +193,7 @@ int32_t UserAuth::CancelAuth(const uint64_t contextId)
int32_t ret = proxy_->CancelAuth(contextId); int32_t ret = proxy_->CancelAuth(contextId);
return ret; return ret;
} }
int32_t UserAuth::GetVersion() int32_t UserAuth::GetVersion()
{ {
USERAUTH_HILOGD(MODULE_INNERKIT, "userauth GetVersion is start"); USERAUTH_HILOGD(MODULE_INNERKIT, "userauth GetVersion is start");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (C) 2021 Huawei Device Co., Ltd. # Copyright (C) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -126,7 +126,7 @@ napi_value UserAuthServiceConstructor(napi_env env, napi_callback_info info);
napi_value GetVersion(napi_env env, napi_callback_info info); napi_value GetVersion(napi_env env, napi_callback_info info);
/** /**
* @brief Get the Availabe Status object * @brief Get the available Status object
* *
* @param env * @param env
* @param info * @param info

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -35,8 +35,8 @@ Napi_SetPropertyRequest AuthBuild::SetPropertyRequestBuild(napi_env env, napi_va
request.authType_ = convert_.GetInt32ValueByKey(env, object, "authType"); request.authType_ = convert_.GetInt32ValueByKey(env, object, "authType");
request.key_ = convert_.GetInt32ValueByKey(env, object, "key"); request.key_ = convert_.GetInt32ValueByKey(env, object, "key");
request.setInfo_ = convert_.NapiGetValueUint8Array(env, object, "setInfo"); request.setInfo_ = convert_.NapiGetValueUint8Array(env, object, "setInfo");
USERAUTH_HILOGI(MODULE_JS_NAPI, "AuthBuild::SetPropertyRequestBuild authType = %{public}d, key = %{public}d", USERAUTH_HILOGI(MODULE_JS_NAPI, "AuthBuild::SetPropertyRequestBuild authType = %{public}d",
request.authType_, request.key_); request.authType_);
return request; return request;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -120,7 +120,7 @@ void AuthApiCallback::OnAuthAcquireInfo(AcquireInfoInner *acquireInfoInner)
napi_value callback; napi_value callback;
napi_status napiStatus = napi_get_reference_value(env, acquireInfoInner->onAcquireInfo, &callback); napi_status napiStatus = napi_get_reference_value(env, acquireInfoInner->onAcquireInfo, &callback);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value failed");
delete acquireInfoInner; delete acquireInfoInner;
delete work; delete work;
return; return;
@ -131,7 +131,7 @@ void AuthApiCallback::OnAuthAcquireInfo(AcquireInfoInner *acquireInfoInner)
napi_create_int32(env, acquireInfoInner->extraInfo, &params[PARAM2]); napi_create_int32(env, acquireInfoInner->extraInfo, &params[PARAM2]);
napiStatus = napi_call_function(env, nullptr, callback, PARAM3, params, &returnOnAcquire); napiStatus = napi_call_function(env, nullptr, callback, PARAM3, params, &returnOnAcquire);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
} }
delete acquireInfoInner; delete acquireInfoInner;
delete work; delete work;
@ -187,7 +187,7 @@ static void OnUserAuthResultWork(uv_work_t *work, int status)
napi_value callback; napi_value callback;
napi_status napiStatus = napi_get_reference_value(env, userInfo->onResult, &callback); napi_status napiStatus = napi_get_reference_value(env, userInfo->onResult, &callback);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value failed");
delete userInfo; delete userInfo;
delete work; delete work;
return; return;
@ -242,7 +242,7 @@ static void OnAuthResultWork(uv_work_t *work, int status)
napi_value callback; napi_value callback;
napi_status napiStatus = napi_get_reference_value(env, authInfo->onResult, &callback); napi_status napiStatus = napi_get_reference_value(env, authInfo->onResult, &callback);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value failed");
delete authInfo; delete authInfo;
delete work; delete work;
return; return;
@ -296,7 +296,7 @@ static void OnExecuteResultWork(uv_work_t *work, int status)
napi_env env = executeInfo->env; napi_env env = executeInfo->env;
napi_value result; napi_value result;
if (napi_create_int32(env, executeInfo->result, &result) != napi_ok) { if (napi_create_int32(env, executeInfo->result, &result) != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 failed");
delete work; delete work;
delete executeInfo; delete executeInfo;
return; return;
@ -389,19 +389,19 @@ static void GetPropertyInfoCallback(uv_work_t* work, int status)
napi_value global = nullptr; napi_value global = nullptr;
napi_status napiStatus = napi_get_global(env, &global); napi_status napiStatus = napi_get_global(env, &global);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global failed");
goto EXIT; goto EXIT;
} }
napi_value resultValue = nullptr; napi_value resultValue = nullptr;
napi_value callBack = nullptr; napi_value callBack = nullptr;
napiStatus = napi_get_reference_value(env, getPropertyInfo->callBackInfo.callBack, &callBack); napiStatus = napi_get_reference_value(env, getPropertyInfo->callBackInfo.callBack, &callBack);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value failed");
goto EXIT; goto EXIT;
} }
napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &resultValue); napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &resultValue);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
goto EXIT; goto EXIT;
} }
} else { } else {
@ -410,7 +410,7 @@ static void GetPropertyInfoCallback(uv_work_t* work, int status)
napi_deferred deferred = getPropertyInfo->callBackInfo.deferred; napi_deferred deferred = getPropertyInfo->callBackInfo.deferred;
napi_status napiStatus = napi_resolve_deferred(env, deferred, resultValue); napi_status napiStatus = napi_resolve_deferred(env, deferred, resultValue);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_resolve_deferred faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_resolve_deferred failed");
goto EXIT; goto EXIT;
} }
} }
@ -495,14 +495,14 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
napi_env env = setPropertyInfo->callBackInfo.env; napi_env env = setPropertyInfo->callBackInfo.env;
napi_status napiStatus = napi_create_int32(env, setPropertyInfo->setResult, &setPropertyInfo->result); napi_status napiStatus = napi_create_int32(env, setPropertyInfo->setResult, &setPropertyInfo->result);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 failed");
goto EXIT; goto EXIT;
} }
if (setPropertyInfo->callBackInfo.callBack != nullptr) { if (setPropertyInfo->callBackInfo.callBack != nullptr) {
napi_value global = nullptr; napi_value global = nullptr;
napiStatus = napi_get_global(env, &global); napiStatus = napi_get_global(env, &global);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global failed");
goto EXIT; goto EXIT;
} }
napi_value resultData[PARAM1]; napi_value resultData[PARAM1];
@ -512,12 +512,12 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
napi_value callBack = nullptr; napi_value callBack = nullptr;
napiStatus = napi_get_reference_value(env, setPropertyInfo->callBackInfo.callBack, &callBack); napiStatus = napi_get_reference_value(env, setPropertyInfo->callBackInfo.callBack, &callBack);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_reference_value failed");
goto EXIT; goto EXIT;
} }
napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &result); napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &result);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
goto EXIT; goto EXIT;
} }
} else { } else {
@ -525,7 +525,7 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
napi_deferred deferred = setPropertyInfo->callBackInfo.deferred; napi_deferred deferred = setPropertyInfo->callBackInfo.deferred;
napiStatus = napi_resolve_deferred(env, deferred, result); napiStatus = napi_resolve_deferred(env, deferred, result);
if (napiStatus != napi_ok) { if (napiStatus != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
goto EXIT; goto EXIT;
} }
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -81,7 +81,7 @@ napi_valuetype ResultConvert::GetType(napi_env env, napi_value value)
napi_valuetype type; napi_valuetype type;
status = napi_typeof(env, value, &type); status = napi_typeof(env, value, &type);
if (status != napi_ok) { if (status != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_typeof faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_typeof failed");
} }
return type; return type;
} }
@ -138,13 +138,13 @@ std::vector<uint32_t> ResultConvert::GetInt32ArrayValueByKey(napi_env env, napi_
bool isArray = false; bool isArray = false;
status = napi_is_array(env, array, &isArray); status = napi_is_array(env, array, &isArray);
if (status != napi_ok) { if (status != napi_ok) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "napi_is_array is failed"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_is_array is failed");
return std::vector<uint32_t>(); return std::vector<uint32_t>();
} }
if (isArray) { if (isArray) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "args[PIN_PARAMS_ONE] is a array"); USERAUTH_HILOGI(MODULE_JS_NAPI, "args[PIN_PARAMS_ONE] is a array");
} else { } else {
USERAUTH_HILOGI(MODULE_JS_NAPI, "args[PIN_PARAMS_ONE] is not a array"); USERAUTH_HILOGE(MODULE_JS_NAPI, "args[PIN_PARAMS_ONE] is not a array");
return std::vector<uint32_t>(); return std::vector<uint32_t>();
} }
return GetCppArrayUint32(env, array); return GetCppArrayUint32(env, array);
@ -163,7 +163,7 @@ std::string ResultConvert::NapiGetValueString(napi_env env, napi_value value)
size_t resultSize = 0; size_t resultSize = 0;
status = napi_get_value_string_utf8(env, value, valueString, valueSize, &resultSize); status = napi_get_value_string_utf8(env, value, valueString, valueSize, &resultSize);
if (status != napi_ok) { if (status != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_value_string_utf8 faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_value_string_utf8 failed");
} }
resultValue = valueString; resultValue = valueString;
if (resultValue == "") { if (resultValue == "") {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -76,7 +76,7 @@ napi_value GetVersion(napi_env env, napi_callback_info info)
} }
/** /**
* @brief Get the Availabe Status object * @brief Get the available Status object
* *
* @param env * @param env
* @param info * @param info
@ -459,11 +459,11 @@ napi_value UserAuthInit(napi_env env, napi_value exports)
status = napi_define_properties(env, exports, status = napi_define_properties(env, exports,
sizeof(exportFuncs) / sizeof(napi_property_descriptor), exportFuncs); sizeof(exportFuncs) / sizeof(napi_property_descriptor), exportFuncs);
if (status != napi_ok) { if (status != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_define_properties faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_define_properties failed");
} }
status = napi_set_named_property(env, exports, "UserAuth", GetCtor(env)); status = napi_set_named_property(env, exports, "UserAuth", GetCtor(env));
if (status != napi_ok) { if (status != napi_ok) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_set_named_property faild"); USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_set_named_property failed");
} }
return exports; return exports;
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -159,7 +159,11 @@ void UserAuthImpl::GetPropertyExecute(napi_env env, void *data)
request.authType = authTypeGet; request.authType = authTypeGet;
request.keys = getPropertyInfo->keys; request.keys = getPropertyInfo->keys;
USERAUTH_HILOGI(MODULE_JS_NAPI, "GetPropertyExecute start 1"); USERAUTH_HILOGI(MODULE_JS_NAPI, "GetPropertyExecute start 1");
GetPropApiCallback *object = new GetPropApiCallback(getPropertyInfo); GetPropApiCallback *object = new (std::nothrow) GetPropApiCallback(getPropertyInfo);
if (object == nullptr) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s object nullptr", __func__);
return;
}
std::shared_ptr<GetPropApiCallback> callback; std::shared_ptr<GetPropApiCallback> callback;
callback.reset(object); callback.reset(object);
UserAuth::GetInstance().GetProperty(request, callback); UserAuth::GetInstance().GetProperty(request, callback);
@ -299,7 +303,11 @@ void UserAuthImpl::SetPropertyExecute(napi_env env, void *data)
request.authType = authTypeGet; request.authType = authTypeGet;
request.key = SetPropertyType(setPropertyInfo->key); request.key = SetPropertyType(setPropertyInfo->key);
request.setInfo = setPropertyInfo->setInfo; request.setInfo = setPropertyInfo->setInfo;
SetPropApiCallback *object = new SetPropApiCallback(setPropertyInfo); SetPropApiCallback *object = new (std::nothrow) SetPropApiCallback(setPropertyInfo);
if (object == nullptr) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s object nullptr", __func__);
return;
}
std::shared_ptr<SetPropApiCallback> callback; std::shared_ptr<SetPropApiCallback> callback;
callback.reset(object); callback.reset(object);
UserAuth::GetInstance().SetProperty(request, callback); UserAuth::GetInstance().SetProperty(request, callback);
@ -472,7 +480,10 @@ bool UserAuthImpl::GetExecuteInfo(napi_env env, napi_value* argv, ExecuteInfo* e
size_t len = 0; size_t len = 0;
napi_get_value_string_utf8(env, argv[PARAM0], nullptr, 0, &len); napi_get_value_string_utf8(env, argv[PARAM0], nullptr, 0, &len);
if (len > 0) { if (len > 0) {
str = new char[len + 1](); str = new (std::nothrow) char[len + 1]();
if (str == nullptr) {
return false;
}
napi_get_value_string_utf8(env, argv[PARAM0], str, len + 1, &len); napi_get_value_string_utf8(env, argv[PARAM0], str, len + 1, &len);
executeInfo->type = str; executeInfo->type = str;
delete[] str; delete[] str;
@ -483,7 +494,10 @@ bool UserAuthImpl::GetExecuteInfo(napi_env env, napi_value* argv, ExecuteInfo* e
} }
napi_get_value_string_utf8(env, argv[PARAM1], nullptr, 0, &len); napi_get_value_string_utf8(env, argv[PARAM1], nullptr, 0, &len);
if (len > 0) { if (len > 0) {
str = new char[len + 1](); str = new (std::nothrow) char[len + 1]();
if (str == nullptr) {
return false;
}
napi_get_value_string_utf8(env, argv[PARAM1], str, len + 1, &len); napi_get_value_string_utf8(env, argv[PARAM1], str, len + 1, &len);
executeInfo->level = str; executeInfo->level = str;
delete[] str; delete[] str;
@ -500,13 +514,13 @@ napi_value UserAuthImpl::Auth(napi_env env, napi_callback_info info)
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start", __func__); USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start", __func__);
AuthInfo *authInfo = new (std::nothrow) AuthInfo(); AuthInfo *authInfo = new (std::nothrow) AuthInfo();
if (authInfo == nullptr) { if (authInfo == nullptr) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s authInfo nullptr", __func__); USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s authInfo nullptr", __func__);
return nullptr; return nullptr;
} }
authInfo->info = info; authInfo->info = info;
napi_value ret = BuildAuthInfo(env, authInfo); napi_value ret = BuildAuthInfo(env, authInfo);
if (ret == nullptr) { if (ret == nullptr) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s BuildAuthInfo fail", __func__); USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s BuildAuthInfo fail", __func__);
delete authInfo; delete authInfo;
return ret; return ret;
} }
@ -516,7 +530,11 @@ napi_value UserAuthImpl::Auth(napi_env env, napi_callback_info info)
napi_value UserAuthImpl::AuthWrap(napi_env env, AuthInfo *authInfo) napi_value UserAuthImpl::AuthWrap(napi_env env, AuthInfo *authInfo)
{ {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__); USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__);
AuthApiCallback *object = new AuthApiCallback(authInfo); AuthApiCallback *object = new (std::nothrow) AuthApiCallback(authInfo);
if (object == nullptr) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s object nullptr", __func__);
return nullptr;
}
std::shared_ptr<AuthApiCallback> callback; std::shared_ptr<AuthApiCallback> callback;
callback.reset(object); callback.reset(object);
uint64_t result = UserAuth::GetInstance().Auth( uint64_t result = UserAuth::GetInstance().Auth(
@ -532,14 +550,14 @@ napi_value UserAuthImpl::AuthUser(napi_env env, napi_callback_info info)
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__); USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__);
AuthUserInfo *userInfo = new (std::nothrow) AuthUserInfo(); AuthUserInfo *userInfo = new (std::nothrow) AuthUserInfo();
if (userInfo == nullptr) { if (userInfo == nullptr) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s userInfo nullptr", __func__); USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s userInfo nullptr", __func__);
return nullptr; return nullptr;
} }
userInfo->callBackInfo.env = env; userInfo->callBackInfo.env = env;
userInfo->info = info; userInfo->info = info;
napi_value ret = BuildAuthUserInfo(env, userInfo); napi_value ret = BuildAuthUserInfo(env, userInfo);
if (ret == nullptr) { if (ret == nullptr) {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s BuildAuthUserInfo fail", __func__); USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s BuildAuthUserInfo fail", __func__);
delete userInfo; delete userInfo;
return ret; return ret;
} }
@ -586,7 +604,11 @@ napi_value UserAuthImpl::BuildAuthUserInfo(napi_env env, AuthUserInfo *userInfo)
napi_value UserAuthImpl::AuthUserWrap(napi_env env, AuthUserInfo *userInfo) napi_value UserAuthImpl::AuthUserWrap(napi_env env, AuthUserInfo *userInfo)
{ {
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__); USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, start.", __func__);
AuthApiCallback *object = new AuthApiCallback(userInfo); AuthApiCallback *object = new (std::nothrow) AuthApiCallback(userInfo);
if (object == nullptr) {
USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s object nullptr", __func__);
return nullptr;
}
std::shared_ptr<AuthApiCallback> callback; std::shared_ptr<AuthApiCallback> callback;
callback.reset(object); callback.reset(object);
uint64_t result = UserAuth::GetInstance().AuthUser(userInfo->userId, userInfo->challenge, uint64_t result = UserAuth::GetInstance().AuthUser(userInfo->userId, userInfo->challenge,

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -26,6 +26,7 @@ enum AuthType : uint32_t {
PIN = 1, PIN = 1,
FACE = 2, FACE = 2,
}; };
// Authentication subtype (2D face, 3D face...) // Authentication subtype (2D face, 3D face...)
enum AuthSubType : uint64_t { enum AuthSubType : uint64_t {
/** /**
@ -49,6 +50,7 @@ enum AuthSubType : uint64_t {
*/ */
FACE_3D = 20001 FACE_3D = 20001
}; };
// Certification result confidence level // Certification result confidence level
enum AuthTurstLevel : uint32_t { enum AuthTurstLevel : uint32_t {
// level 1-4 // level 1-4
@ -57,6 +59,7 @@ enum AuthTurstLevel : uint32_t {
ATL3 = 30000, ATL3 = 30000,
ATL4 = 40000 ATL4 = 40000
}; };
// Actuator get property list // Actuator get property list
enum GetPropertyType : uint32_t { enum GetPropertyType : uint32_t {
// Authentication subtype (at this point the authentication type has been confirmed) // Authentication subtype (at this point the authentication type has been confirmed)
@ -66,12 +69,14 @@ enum GetPropertyType : uint32_t {
// Freeze time // Freeze time
FREEZING_TIME = 3, FREEZING_TIME = 3,
}; };
// get attribute request // get attribute request
struct GetPropertyRequest { struct GetPropertyRequest {
AuthType authType {0}; AuthType authType {0};
// GetPropertyType // GetPropertyType
std::vector<uint32_t> keys {}; std::vector<uint32_t> keys {};
}; };
// Actuator properties // Actuator properties
struct ExecutorProperty { struct ExecutorProperty {
int32_t result; int32_t result;
@ -79,6 +84,7 @@ struct ExecutorProperty {
uint32_t remainTimes; uint32_t remainTimes;
uint32_t freezingTime; uint32_t freezingTime;
}; };
// Actuator property mode list // Actuator property mode list
enum AuthPropertyMode : uint32_t { enum AuthPropertyMode : uint32_t {
PROPERMODE_DELETE = 0, PROPERMODE_DELETE = 0,
@ -89,23 +95,27 @@ enum AuthPropertyMode : uint32_t {
PROPERMODE_INIT_ALGORITHM = 5, PROPERMODE_INIT_ALGORITHM = 5,
PROPERMODE_RELEASE_ALGORITHM = 6, PROPERMODE_RELEASE_ALGORITHM = 6,
}; };
// Actuator property list // Actuator property list
enum SetPropertyType : uint32_t { enum SetPropertyType : uint32_t {
INIT_ALGORITHM = 1, INIT_ALGORITHM = 1,
FREEZE_TEMPLATE = 2, FREEZE_TEMPLATE = 2,
THAW_TEMPLATE = 3, THAW_TEMPLATE = 3,
}; };
struct SetPropertyRequest { struct SetPropertyRequest {
AuthType authType {0}; AuthType authType {0};
SetPropertyType key {0}; SetPropertyType key {0};
std::vector<uint8_t> setInfo {}; std::vector<uint8_t> setInfo {};
}; };
// Authentication Result // Authentication Result
struct AuthResult { struct AuthResult {
std::vector<uint8_t> token {}; std::vector<uint8_t> token {};
uint32_t remainTimes {0}; uint32_t remainTimes {0};
uint32_t freezingTime {0}; uint32_t freezingTime {0};
}; };
struct CoAuthInfo { struct CoAuthInfo {
AuthType authType {0}; AuthType authType {0};
uint64_t callerID {0}; uint64_t callerID {0};
@ -122,6 +132,12 @@ struct FreezInfo {
AuthType authType; AuthType authType;
}; };
struct UserInfo {
uint64_t callerUID;
int32_t userID {0};
std::string pkgName;
};
// Result Code // Result Code
enum ResultCode : int32_t { enum ResultCode : int32_t {
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2021 Huawei Device Co., Ltd. <!-- Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License"); Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License. you may not use this file except in compliance with the License.
You may obtain a copy of the License at You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -42,14 +42,14 @@ public:
* after the callback of the coAuth is called to obtain the scheduling token * after the callback of the coAuth is called to obtain the scheduling token
* and the authentication result is successful. * and the authentication result is successful.
* */ * */
void CoauthSetPropAuthInfo(int32_t userID, int32_t resultCode, uint64_t callerUID, std::string pkgName, void CoauthSetPropAuthInfo(UserInfo userInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset); UserAuthToken authToken, SetPropertyRequest requset);
/* Set the executor authentication properties for freez or unfreez */ /* Set the executor authentication properties for freez or unfreez */
void SetPropAuthInfo(uint64_t callerUID, std::string pkgName, int32_t resultCode, UserAuthToken authToken, void SetPropAuthInfo(UserInfo userInfo, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest requset, std::vector<uint64_t> templateIds); SetPropertyRequest requset, std::vector<uint64_t> templateIds);
/* get the executor authentication properties for Coauth */ /* get the executor authentication properties for Coauth */
void GetPropAuthInfoCoauth(int32_t userID, uint64_t callerUID, std::string pkgName, int32_t resultCode, void GetPropAuthInfoCoauth(UserInfo userInfo, int32_t resultCode,
UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback); UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback);
int32_t GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds); int32_t GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds);
int32_t RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken, UserAuthToken &authToken, int32_t RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken, UserAuthToken &authToken,
@ -70,8 +70,8 @@ private:
~UserAuthAdapter() = default; ~UserAuthAdapter() = default;
int32_t GetEachExecutorProp(GetPropertyRequest &requset, ExecutorProperty &result, uint32_t &value, int32_t GetEachExecutorProp(GetPropertyRequest &requset, ExecutorProperty &result, uint32_t &value,
std::shared_ptr<OHOS::UserIAM::AuthResPool::AuthAttributes> pAuthAttributes); std::shared_ptr<OHOS::UserIAM::AuthResPool::AuthAttributes> pAuthAttributes);
int32_t SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, uint64_t callerUID, int32_t SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, UserInfo userInfo,
std::string pkgName, SetPropertyRequest requset, std::vector<uint64_t> templateIds, SetPropertyRequest requset, std::vector<uint64_t> templateIds,
std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback); std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback);
}; };
} // namespace UserAuth } // namespace UserAuth

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -90,14 +90,14 @@ private:
class UserAuthCallbackImplIDMGetPorp : public UserIDM::GetInfoCallback { class UserAuthCallbackImplIDMGetPorp : public UserIDM::GetInfoCallback {
public: public:
explicit UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl, explicit UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl,
GetPropertyRequest requst, uint64_t callerUID, std::string pkgName); GetPropertyRequest request, uint64_t callerUID, std::string pkgName);
virtual ~UserAuthCallbackImplIDMGetPorp() = default; virtual ~UserAuthCallbackImplIDMGetPorp() = default;
void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override; void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override;
private: private:
sptr<IUserAuthCallback> callback_ { nullptr }; sptr<IUserAuthCallback> callback_ { nullptr };
GetPropertyRequest requst_; GetPropertyRequest request_;
std::string pkgName_; std::string pkgName_;
uint64_t callerUid_; uint64_t callerUid_;
}; };

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -38,7 +38,7 @@ UserAuthAdapter &UserAuthAdapter::GetInstance()
int32_t UserAuthAdapter::GetAuthTrustLevel(int32_t userId, uint32_t authType, uint32_t &authTrustLevel) int32_t UserAuthAdapter::GetAuthTrustLevel(int32_t userId, uint32_t authType, uint32_t &authTrustLevel)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetAuthTrustLevel is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetAuthTrustLevel is start!");
int32_t ret = OHOS::UserIAM::UserAuth::GetAuthTrustLevel(userId, authType, authTrustLevel); int32_t ret = OHOS::UserIAM::UserAuth::GetAuthTrustLevel(userId, authType, authTrustLevel);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetAuthTrustLevel ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetAuthTrustLevel ERROR!");
@ -50,7 +50,7 @@ int32_t UserAuthAdapter::GetAuthTrustLevel(int32_t userId, uint32_t authType, ui
void UserAuthAdapter::GetPropAuthInfo(int32_t userID, uint64_t callerUID, std::string pkgName, void UserAuthAdapter::GetPropAuthInfo(int32_t userID, uint64_t callerUID, std::string pkgName,
GetPropertyRequest requset, sptr<IUserAuthCallback> &callback) GetPropertyRequest requset, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfo is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfo is start!");
using namespace UserIDM; using namespace UserIDM;
std::shared_ptr<GetInfoCallback> getInfoCallback = std::shared_ptr<GetInfoCallback> getInfoCallback =
std::make_shared<UserAuthCallbackImplIDMGetPorp>(callback, requset, callerUID, pkgName); std::make_shared<UserAuthCallbackImplIDMGetPorp>(callback, requset, callerUID, pkgName);
@ -59,32 +59,37 @@ void UserAuthAdapter::GetPropAuthInfo(int32_t userID, uint64_t callerUID, std::s
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetPropAuthInfo ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetPropAuthInfo ERROR!");
} }
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfo is end!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfo is end!");
} }
void UserAuthAdapter::SetPropAuthInfo(uint64_t callerUID, std::string pkgName, int32_t resultCode, void UserAuthAdapter::SetPropAuthInfo(UserInfo userInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset, std::vector<uint64_t> templateIds) UserAuthToken authToken, SetPropertyRequest requset, std::vector<uint64_t> templateIds)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetPropAuthInfo is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth SetPropAuthInfo is start!");
using namespace AuthResPool; using namespace AuthResPool;
FreezInfo freezInfo; FreezInfo freezInfo;
freezInfo.callerID = callerUID; freezInfo.callerID = userInfo.callerUID;
freezInfo.authType = requset.authType; freezInfo.authType = requset.authType;
freezInfo.pkgName = pkgName; freezInfo.pkgName = userInfo.pkgName;
freezInfo.resultCode = resultCode; freezInfo.resultCode = resultCode;
std::shared_ptr<CoAuth::SetPropCallback> setPropCallback = std::shared_ptr<CoAuth::SetPropCallback> setPropCallback =
std::make_shared<UserAuthCallbackImplSetPropFreez>(templateIds, authToken, freezInfo); std::make_shared<UserAuthCallbackImplSetPropFreez>(templateIds, authToken, freezInfo);
if (setPropCallback == nullptr) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetPropAuthInfo setPropCallback nullptr!");
return;
}
AuthAttributes authAttributes; AuthAttributes authAttributes;
int32_t ret = SetProPropAuthInfo(authAttributes, callerUID, pkgName, requset, templateIds, setPropCallback); int32_t ret = SetProPropAuthInfo(authAttributes, userInfo, requset, templateIds, setPropCallback);
if (ret != SUCCESS) { if (ret != SUCCESS) {
return; return;
} }
CoAuth::CoAuth::GetInstance().SetExecutorProp(authAttributes, setPropCallback); CoAuth::CoAuth::GetInstance().SetExecutorProp(authAttributes, setPropCallback);
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetPropAuthInfo is end!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth SetPropAuthInfo is end!");
} }
int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes,
uint64_t callerUID, std::string pkgName, SetPropertyRequest requset, std::vector<uint64_t> templateIds, UserInfo userInfo, SetPropertyRequest requset, std::vector<uint64_t> templateIds,
std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback) std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback)
{ {
uint32_t value; uint32_t value;
@ -105,7 +110,7 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
setPropCallback->OnResult(ret, extraInfo); setPropCallback->OnResult(ret, extraInfo);
return ret; return ret;
} }
ret = authAttributes.SetUint64Value(AUTH_CALLER_UID, callerUID); ret = authAttributes.SetUint64Value(AUTH_CALLER_UID, userInfo.callerUID);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint32Value AUTH_CALLER_UID ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint32Value AUTH_CALLER_UID ERROR!");
std::vector<uint8_t> extraInfo; std::vector<uint8_t> extraInfo;
@ -113,9 +118,9 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
return ret; return ret;
} }
std::vector<uint8_t> pkgNameValue; std::vector<uint8_t> pkgNameValue;
pkgName.resize(pkgName.size()); userInfo.pkgName.resize(userInfo.pkgName.size());
pkgNameValue.clear(); pkgNameValue.clear();
pkgNameValue.assign(pkgName.begin(), pkgName.end()); pkgNameValue.assign(userInfo.pkgName.begin(), userInfo.pkgName.end());
ret = authAttributes.SetUint8ArrayValue(AUTH_CALLER_NAME, pkgNameValue); ret = authAttributes.SetUint8ArrayValue(AUTH_CALLER_NAME, pkgNameValue);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint8ArrayValue->AUTH_CALLER_NAME ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint8ArrayValue->AUTH_CALLER_NAME ERROR!");
@ -132,39 +137,39 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
} }
return ret; return ret;
} }
void UserAuthAdapter::GetPropAuthInfoCoauth(int32_t userID, uint64_t callerUID, std::string pkgName, int32_t resultCode, void UserAuthAdapter::GetPropAuthInfoCoauth(UserInfo userInfo, int32_t resultCode,
UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback) UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is start!");
using namespace UserIDM; using namespace UserIDM;
std::shared_ptr<GetInfoCallback> getInfoCallback = std::make_shared<UserAuthCallbackImplIDMGetPorpCoauth>(callback, std::shared_ptr<GetInfoCallback> getInfoCallback = std::make_shared<UserAuthCallbackImplIDMGetPorpCoauth>(callback,
callerUID, pkgName, resultCode, authToken, requset); userInfo.callerUID, userInfo.pkgName, resultCode, authToken, requset);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userID, static_cast<UserIDM::AuthType>(requset.authType), int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userInfo.userID,
getInfoCallback); static_cast<UserIDM::AuthType>(requset.authType), getInfoCallback);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth ERROR!");
} }
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is end!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is end!");
} }
void UserAuthAdapter::CoauthSetPropAuthInfo(int32_t userID, int32_t resultCode, uint64_t callerUID, std::string pkgName, void UserAuthAdapter::CoauthSetPropAuthInfo(UserInfo userInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset) UserAuthToken authToken, SetPropertyRequest requset)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is start!");
using namespace UserIDM; using namespace UserIDM;
std::shared_ptr<GetInfoCallback> setPropCallback = std::make_shared<UserAuthCallbackImplIDMCothGetPorpFreez>( std::shared_ptr<GetInfoCallback> setPropCallback = std::make_shared<UserAuthCallbackImplIDMCothGetPorpFreez>(
callerUID, pkgName, resultCode, authToken, requset); userInfo.callerUID, userInfo.pkgName, resultCode, authToken, requset);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userID, static_cast<UserIDM::AuthType>(requset.authType), int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userInfo.userID,
setPropCallback); static_cast<UserIDM::AuthType>(requset.authType), setPropCallback);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo ERROR!");
} }
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is end!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is end!");
} }
int32_t UserAuthAdapter::GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds) int32_t UserAuthAdapter::GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GenerateSolution is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GenerateSolution is start!");
int32_t ret = OHOS::UserIAM::UserAuth::GenerateSolution(param, sessionIds); int32_t ret = OHOS::UserIAM::UserAuth::GenerateSolution(param, sessionIds);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GenerateSolution ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth GenerateSolution ERROR!");
@ -175,18 +180,18 @@ int32_t UserAuthAdapter::GenerateSolution(AuthSolution param, std::vector<uint64
int32_t UserAuthAdapter::RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken, int32_t UserAuthAdapter::RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken,
UserAuthToken &authToken, std::vector<uint64_t> &sessionIds) UserAuthToken &authToken, std::vector<uint64_t> &sessionIds)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth RequestAuthResult is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth RequestAuthResult is start!");
int32_t ret = OHOS::UserIAM::UserAuth::RequestAuthResult(contextId, scheduleToken, authToken, sessionIds); int32_t ret = OHOS::UserIAM::UserAuth::RequestAuthResult(contextId, scheduleToken, authToken, sessionIds);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth RequestAuthResult ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth RequestAuthResult ERROR!");
} }
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth RequestAuthResult is end!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth RequestAuthResult is end!");
return ret; return ret;
} }
int32_t UserAuthAdapter::CancelContext(uint64_t contextId, std::vector<uint64_t> &sessionIds) int32_t UserAuthAdapter::CancelContext(uint64_t contextId, std::vector<uint64_t> &sessionIds)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth CancelContext is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth CancelContext is start!");
int32_t ret = OHOS::UserIAM::UserAuth::CancelContext(contextId, sessionIds); int32_t ret = OHOS::UserIAM::UserAuth::CancelContext(contextId, sessionIds);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth CancelContext ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth CancelContext ERROR!");
@ -196,7 +201,7 @@ int32_t UserAuthAdapter::CancelContext(uint64_t contextId, std::vector<uint64_t>
int32_t UserAuthAdapter::Cancel(uint64_t sessionId) int32_t UserAuthAdapter::Cancel(uint64_t sessionId)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth Cancel is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth Cancel is start!");
int32_t ret = CoAuth::CoAuth::GetInstance().Cancel(sessionId); int32_t ret = CoAuth::CoAuth::GetInstance().Cancel(sessionId);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth Cancel ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth Cancel ERROR!");
@ -206,7 +211,7 @@ int32_t UserAuthAdapter::Cancel(uint64_t sessionId)
int32_t UserAuthAdapter::GetVersion() int32_t UserAuthAdapter::GetVersion()
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetVersion is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetVersion is start!");
int32_t version = g_userAuthVersion; int32_t version = g_userAuthVersion;
return version; return version;
@ -215,7 +220,7 @@ int32_t UserAuthAdapter::GetVersion()
int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUID, std::string pkgName, uint64_t templateId, int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUID, std::string pkgName, uint64_t templateId,
GetPropertyRequest requset, ExecutorProperty &result) GetPropertyRequest requset, ExecutorProperty &result)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetExecutorProp is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetExecutorProp is start!");
using namespace AuthResPool; using namespace AuthResPool;
uint32_t value; uint32_t value;
@ -308,7 +313,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut
return INVALID_PARAMETERS; return INVALID_PARAMETERS;
} }
} }
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthAdapter::GetEachExecutorProp %{public}" PRIu64 ":%{public}u:%{public}u", USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthAdapter::GetEachExecutorProp %{public}" PRIu64 ":%{public}u:%{public}u",
result.authSubType, result.remainTimes, result.freezingTime); result.authSubType, result.remainTimes, result.freezingTime);
return ret; return ret;
} }
@ -316,7 +321,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut
int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUID, std::string pkgName, SetPropertyRequest requset, int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUID, std::string pkgName, SetPropertyRequest requset,
sptr<IUserAuthCallback> &callback) sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetExecutorProp is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth SetExecutorProp is start!");
using namespace AuthResPool; using namespace AuthResPool;
uint32_t value; uint32_t value;
@ -360,7 +365,7 @@ int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUID, std::string pkgName
int32_t UserAuthAdapter::coAuth(CoAuthInfo coAuthInfo, sptr<IUserAuthCallback> &callback) int32_t UserAuthAdapter::coAuth(CoAuthInfo coAuthInfo, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth coAuth is start!"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth coAuth is start!");
std::shared_ptr<CoAuth::CoAuthCallback> coAuthCallback = std::shared_ptr<CoAuth::CoAuthCallback> coAuthCallback =
std::make_shared<UserAuthCallbackImplCoAuth>(callback, coAuthInfo, false); std::make_shared<UserAuthCallbackImplCoAuth>(callback, coAuthInfo, false);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -57,7 +57,7 @@ void UserAuthAsyncProxy::onResult(const int32_t result, const AuthResult extraIn
MessageParcel data; MessageParcel data;
MessageParcel reply; MessageParcel reply;
if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) { if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) {
USERAUTH_HILOGI(MODULE_SERVICE, "userauth write descriptor failed!"); USERAUTH_HILOGE(MODULE_SERVICE, "userauth write descriptor failed!");
return; return;
} }
if (!data.WriteInt32(result)) { if (!data.WriteInt32(result)) {
@ -89,7 +89,7 @@ void UserAuthAsyncProxy::onExecutorPropertyInfo(const ExecutorProperty result)
MessageParcel data; MessageParcel data;
MessageParcel reply; MessageParcel reply;
if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) { if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) {
USERAUTH_HILOGI(MODULE_SERVICE, "userauth write descriptor failed!"); USERAUTH_HILOGE(MODULE_SERVICE, "userauth write descriptor failed!");
return; return;
} }
if (!data.WriteInt32(result.result)) { if (!data.WriteInt32(result.result)) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -29,6 +29,7 @@ namespace UserIAM {
namespace UserAuth { namespace UserAuth {
std::mutex UserAuthCallbackImplCoAuth::coauthCallbackmutex_; std::mutex UserAuthCallbackImplCoAuth::coauthCallbackmutex_;
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> UserAuthCallbackImplCoAuth::saveCoauthCallback_; std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> UserAuthCallbackImplCoAuth::saveCoauthCallback_;
UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCallback>& impl) UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCallback>& impl)
{ {
if (impl == nullptr) { if (impl == nullptr) {
@ -37,6 +38,7 @@ UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCal
} }
callback_ = impl; callback_ = impl;
} }
void UserAuthCallbackImplSetProp::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo) void UserAuthCallbackImplSetProp::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetProp OnResult enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetProp OnResult enter");
@ -59,6 +61,7 @@ UserAuthCallbackImplSetPropFreez::UserAuthCallbackImplSetPropFreez(std::vector<u
pkgName_ = freezInfo.pkgName; pkgName_ = freezInfo.pkgName;
callerUid_ = freezInfo.callerID; callerUid_ = freezInfo.callerID;
} }
void UserAuthCallbackImplSetPropFreez::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo) void UserAuthCallbackImplSetPropFreez::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetPropFreez result is %{public}u", result); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetPropFreez result is %{public}u", result);
@ -80,6 +83,7 @@ UserAuthCallbackImplCoAuth::UserAuthCallbackImplCoAuth(const sptr<IUserAuthCallb
callerUid_ = coAuthInfo.callerID; callerUid_ = coAuthInfo.callerID;
userID_ = coAuthInfo.userID; userID_ = coAuthInfo.userID;
} }
void UserAuthCallbackImplCoAuth::OnFinish(uint32_t resultCode, std::vector<uint8_t> &scheduleToken) void UserAuthCallbackImplCoAuth::OnFinish(uint32_t resultCode, std::vector<uint8_t> &scheduleToken)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnFinish enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnFinish enter");
@ -95,6 +99,7 @@ void UserAuthCallbackImplCoAuth::OnFinish(uint32_t resultCode, std::vector<uint8
return; return;
} }
} }
void UserAuthCallbackImplCoAuth::OnAcquireInfo(uint32_t acquire) void UserAuthCallbackImplCoAuth::OnAcquireInfo(uint32_t acquire)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnAcquireInfo enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnAcquireInfo enter");
@ -107,6 +112,7 @@ void UserAuthCallbackImplCoAuth::OnAcquireInfo(uint32_t acquire)
return; return;
} }
} }
void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userID, SetPropertyRequest setPropertyRequest, void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userID, SetPropertyRequest setPropertyRequest,
AuthResult authResult, int32_t ret, UserAuthToken authToken) AuthResult authResult, int32_t ret, UserAuthToken authToken)
{ {
@ -114,8 +120,11 @@ void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userID, SetPropert
USERAUTH_HILOGD(MODULE_SERVICE, "RequestAuthResult SUCCESS"); USERAUTH_HILOGD(MODULE_SERVICE, "RequestAuthResult SUCCESS");
setPropertyRequest.authType = UserAuth::FACE; setPropertyRequest.authType = UserAuth::FACE;
setPropertyRequest.key = SetPropertyType::THAW_TEMPLATE; setPropertyRequest.key = SetPropertyType::THAW_TEMPLATE;
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userID, ret, callerUid_, pkgName_, UserInfo userInfo;
authToken, setPropertyRequest); userInfo.callerUID = callerUid_;
userInfo.userID = userID;
userInfo.pkgName = pkgName_;
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userInfo, ret, authToken, setPropertyRequest);
} }
} }
@ -139,8 +148,12 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
SetPropertyRequest setPropertyRequest; SetPropertyRequest setPropertyRequest;
GetPropertyRequest getPropertyRequest; GetPropertyRequest getPropertyRequest;
AuthResult authResult; AuthResult authResult;
UserInfo userInfo;
int32_t ret = GENERAL_ERROR; int32_t ret = GENERAL_ERROR;
std::lock_guard<std::mutex> lock(mutex_); std::lock_guard<std::mutex> lock(mutex_);
userInfo.callerUID = callerUid_;
userInfo.userID = userID_;
userInfo.pkgName = pkgName_;
USERAUTH_HILOGD(MODULE_SERVICE, "OnFinishHandle scheduleTokensize:%{public}d, resultCode:%{public}u", USERAUTH_HILOGD(MODULE_SERVICE, "OnFinishHandle scheduleTokensize:%{public}d, resultCode:%{public}u",
scheduleToken.size(), resultCode); scheduleToken.size(), resultCode);
callbackNowCount_++; callbackNowCount_++;
@ -165,7 +178,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth resultCode == LOCKED"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth resultCode == LOCKED");
setPropertyRequest.authType = FACE; setPropertyRequest.authType = FACE;
setPropertyRequest.key = SetPropertyType::FREEZE_TEMPLATE; setPropertyRequest.key = SetPropertyType::FREEZE_TEMPLATE;
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userID_, resultCode, callerUid_, pkgName_, authToken, UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userInfo, resultCode, authToken,
setPropertyRequest); setPropertyRequest);
} }
if (ret == SUCCESS) { if (ret == SUCCESS) {
@ -174,7 +187,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
getPropertyRequest.authType = authType_; getPropertyRequest.authType = authType_;
getPropertyRequest.keys.push_back(UserAuth::REMAIN_TIMES); getPropertyRequest.keys.push_back(UserAuth::REMAIN_TIMES);
getPropertyRequest.keys.push_back(UserAuth::FREEZING_TIME); getPropertyRequest.keys.push_back(UserAuth::FREEZING_TIME);
UserAuthAdapter::GetInstance().GetPropAuthInfoCoauth(userID_, callerUid_, pkgName_, resultCode, UserAuthAdapter::GetInstance().GetPropAuthInfoCoauth(userInfo, resultCode,
authToken, getPropertyRequest, callback_); authToken, getPropertyRequest, callback_);
DealFinishData(sessionIds); DealFinishData(sessionIds);
} }
@ -225,7 +238,7 @@ int32_t UserAuthCallbackImplCoAuth::DeleteCoauthCallback(uint64_t contextId)
} }
UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl, UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl,
GetPropertyRequest requst, uint64_t callerUID, GetPropertyRequest request, uint64_t callerUID,
std::string pkgName) std::string pkgName)
{ {
if (impl == nullptr) { if (impl == nullptr) {
@ -233,12 +246,13 @@ UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserA
return; return;
} }
callback_ = impl; callback_ = impl;
requst_.authType = requst.authType; request_.authType = request.authType;
requst_.keys.clear(); request_.keys.clear();
requst_.keys.assign(requst.keys.begin(), requst.keys.end()); request_.keys.assign(request.keys.begin(), request.keys.end());
pkgName_ = pkgName; pkgName_ = pkgName;
callerUid_ = callerUID; callerUid_ = callerUID;
} }
void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorp OnGetInfo enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorp OnGetInfo enter");
@ -249,7 +263,7 @@ void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialIn
return; return;
} }
uint64_t tmp = info.begin()->templateId; uint64_t tmp = info.begin()->templateId;
int32_t ret = UserAuthAdapter::GetInstance().GetExecutorProp(callerUid_, pkgName_, tmp, requst_, executorProperty); int32_t ret = UserAuthAdapter::GetInstance().GetExecutorProp(callerUid_, pkgName_, tmp, request_, executorProperty);
if (ret != SUCCESS) { if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth UserAuthCallbackImplIDMGetPorp ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth UserAuthCallbackImplIDMGetPorp ERROR!");
} }
@ -266,8 +280,14 @@ UserAuthCallbackImplIDMCothGetPorpFreez::UserAuthCallbackImplIDMCothGetPorpFreez
pkgName_ = pkgName; pkgName_ = pkgName;
callerUid_ = callerUid; callerUid_ = callerUid;
} }
void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
{ {
UserInfo userInfo;
userInfo.callerUID = callerUid_;
userInfo.userID = 0;
userInfo.pkgName = pkgName_;
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMCothGetPorpFreez OnGetInfo enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMCothGetPorpFreez OnGetInfo enter");
std::vector<uint64_t> templateIds; std::vector<uint64_t> templateIds;
AuthResult authResult; AuthResult authResult;
@ -283,7 +303,7 @@ void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::Cre
for (auto const &item : info) { for (auto const &item : info) {
templateIds.push_back(item.templateId); templateIds.push_back(item.templateId);
} }
UserAuthAdapter::GetInstance().SetPropAuthInfo(callerUid_, pkgName_, resultCode_, authToken_, requset_, UserAuthAdapter::GetInstance().SetPropAuthInfo(userInfo, resultCode_, authToken_, requset_,
templateIds); templateIds);
} }
@ -302,6 +322,7 @@ UserAuthCallbackImplIDMGetPorpCoauth::UserAuthCallbackImplIDMGetPorpCoauth(
pkgName_ = pkgName; pkgName_ = pkgName;
callerUid_ = callerUid; callerUid_ = callerUid;
} }
void UserAuthCallbackImplIDMGetPorpCoauth::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) void UserAuthCallbackImplIDMGetPorpCoauth::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth OnGetInfo enter"); USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth OnGetInfo enter");

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -40,7 +40,7 @@ UserAuthService::~UserAuthService() = default;
void UserAuthService::OnStart() void UserAuthService::OnStart()
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "Start service"); USERAUTH_HILOGI(MODULE_SERVICE, "Start service");
if (!Publish(this)) { if (!Publish(this)) {
USERAUTH_HILOGE(MODULE_SERVICE, "Failed to publish service"); USERAUTH_HILOGE(MODULE_SERVICE, "Failed to publish service");
} }
@ -54,7 +54,7 @@ void UserAuthService::OnStart()
void UserAuthService::OnStop() void UserAuthService::OnStop()
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "Stop service"); USERAUTH_HILOGI(MODULE_SERVICE, "Stop service");
ContextThreadPool::GetInstance().Stop(); ContextThreadPool::GetInstance().Stop();
bool ret = OHOS::UserIAM::Common::IsIAMInited(); bool ret = OHOS::UserIAM::Common::IsIAMInited();
if (ret) { if (ret) {
@ -77,7 +77,7 @@ bool UserAuthService::CheckPermission(const std::string &permission)
int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel) int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService GetAvailableStatus is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService GetAvailableStatus is start");
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) &&
(authType == PIN || !CheckPermission(ACCESS_BIOMETRIC_PERMISSION))) { (authType == PIN || !CheckPermission(ACCESS_BIOMETRIC_PERMISSION))) {
USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed"); USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed");
@ -100,8 +100,9 @@ int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthT
ret = userauthController_.GetAuthTrustLevel(userID, authType, authTurstLevelFromSys); ret = userauthController_.GetAuthTrustLevel(userID, authType, authTurstLevelFromSys);
if (ret == SUCCESS) { if (ret == SUCCESS) {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService iAuthTurstLevel_:%{public}u", authTurstLevelFromSys); USERAUTH_HILOGD(MODULE_SERVICE,
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService authTurstLevel:%{public}u", authTurstLevel); "UserAuthService iAuthTurstLevel_:%{public}u, authTurstLevel:%{public}u",
authTurstLevelFromSys, authTurstLevel);
if (authTurstLevelFromSys < authTurstLevel) { if (authTurstLevelFromSys < authTurstLevel) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthService authTurstLevel is ERROR!"); USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthService authTurstLevel is ERROR!");
return result; return result;
@ -113,7 +114,7 @@ int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthT
void UserAuthService::GetProperty(const GetPropertyRequest request, sptr<IUserAuthCallback> &callback) void UserAuthService::GetProperty(const GetPropertyRequest request, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService GetProperty is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService GetProperty is start");
uint64_t callerID = 0; uint64_t callerID = 0;
std::string callerName; std::string callerName;
if (callback == nullptr) { if (callback == nullptr) {
@ -148,7 +149,7 @@ void UserAuthService::GetProperty(const GetPropertyRequest request, sptr<IUserAu
void UserAuthService::SetProperty(const SetPropertyRequest request, sptr<IUserAuthCallback> &callback) void UserAuthService::SetProperty(const SetPropertyRequest request, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService SetProperty is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService SetProperty is start");
int ret = GENERAL_ERROR; int ret = GENERAL_ERROR;
uint64_t callerID = 0; uint64_t callerID = 0;
std::string callerName; std::string callerName;
@ -196,14 +197,14 @@ int32_t UserAuthService::GetCallingUserID(int32_t &userID)
return TYPE_NOT_SUPPORT; return TYPE_NOT_SUPPORT;
} }
userID = static_cast<int32_t>(hapTokenInfo.userID); userID = static_cast<int32_t>(hapTokenInfo.userID);
USERAUTH_HILOGE(MODULE_SERVICE, "GetCallingUserID is %{public}d", userID); USERAUTH_HILOGI(MODULE_SERVICE, "GetCallingUserID is %{public}d", userID);
return SUCCESS; return SUCCESS;
} }
uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel, uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
sptr<IUserAuthCallback> &callback) sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService Auth is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService Auth is start");
const uint64_t invalidContextID = 0; const uint64_t invalidContextID = 0;
int32_t userID = 0; int32_t userID = 0;
uint64_t callerID = 0; uint64_t callerID = 0;
@ -261,7 +262,7 @@ uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType
uint64_t UserAuthService::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType, uint64_t UserAuthService::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback) const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService AuthUser is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService AuthUser is start");
const uint64_t invalidContextID = 0; const uint64_t invalidContextID = 0;
uint64_t callerID = 0; uint64_t callerID = 0;
std::string callerName; std::string callerName;
@ -342,7 +343,7 @@ int32_t UserAuthService::GetControllerData(sptr<IUserAuthCallback> &callback, Au
int32_t UserAuthService::CancelAuth(const uint64_t contextId) int32_t UserAuthService::CancelAuth(const uint64_t contextId)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService CancelAuth is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService CancelAuth is start");
int result = INVALID_CONTEXTID; int result = INVALID_CONTEXTID;
std::vector<uint64_t> sessionIds; std::vector<uint64_t> sessionIds;
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && !CheckPermission(ACCESS_BIOMETRIC_PERMISSION)) { if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && !CheckPermission(ACCESS_BIOMETRIC_PERMISSION)) {
@ -371,7 +372,7 @@ int32_t UserAuthService::CancelAuth(const uint64_t contextId)
int32_t UserAuthService::GetVersion() int32_t UserAuthService::GetVersion()
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService GetVersion is start"); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService GetVersion is start");
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && !CheckPermission(ACCESS_BIOMETRIC_PERMISSION)) { if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && !CheckPermission(ACCESS_BIOMETRIC_PERMISSION)) {
USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed"); USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed");
return E_CHECK_PERMISSION_FAILED; return E_CHECK_PERMISSION_FAILED;
@ -395,7 +396,7 @@ void UserAuthService::UserAuthServiceCallbackDeathRecipient::OnRemoteDied(const
} }
callback_ = nullptr; callback_ = nullptr;
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthServiceCallbackDeathRecipient::Recv death notice."); USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthServiceCallbackDeathRecipient::Recv death notice.");
} }
} // namespace UserAuth } // namespace UserAuth
} // namespace UserIAM } // namespace UserIAM

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
@ -23,7 +23,7 @@ namespace UserIAM {
namespace UserAuth { namespace UserAuth {
int32_t UserAuthStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) int32_t UserAuthStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{ {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthStub::OnRemoteRequest, cmd = %{public}d, flags= %{public}d", code, USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthStub::OnRemoteRequest, cmd = %{public}u, flags= %{public}d", code,
option.GetFlags()); option.GetFlags());
std::u16string descripter = UserAuthStub::GetDescriptor(); std::u16string descripter = UserAuthStub::GetDescriptor();
std::u16string remoteDescripter = data.ReadInterfaceToken(); std::u16string remoteDescripter = data.ReadInterfaceToken();
@ -33,19 +33,19 @@ int32_t UserAuthStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag
} }
switch (code) { switch (code) {
case static_cast<int32_t>(IUserAuth::USER_AUTH_GET_AVAILABLE_STATUS): case static_cast<uint32_t>(IUserAuth::USER_AUTH_GET_AVAILABLE_STATUS):
return GetAvailableStatusStub(data, reply); return GetAvailableStatusStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_GET_PROPERTY): case static_cast<uint32_t>(IUserAuth::USER_AUTH_GET_PROPERTY):
return GetPropertyStub(data, reply); return GetPropertyStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_SET_PROPERTY): case static_cast<uint32_t>(IUserAuth::USER_AUTH_SET_PROPERTY):
return SetPropertyStub(data, reply); return SetPropertyStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_AUTH): case static_cast<uint32_t>(IUserAuth::USER_AUTH_AUTH):
return AuthStub(data, reply); return AuthStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_AUTH_USER): case static_cast<uint32_t>(IUserAuth::USER_AUTH_AUTH_USER):
return AuthUserStub(data, reply); return AuthUserStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_CANCEL_AUTH): case static_cast<uint32_t>(IUserAuth::USER_AUTH_CANCEL_AUTH):
return CancelAuthStub(data, reply); return CancelAuthStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_GET_VERSION): case static_cast<uint32_t>(IUserAuth::USER_AUTH_GET_VERSION):
return GetVersionStub(data, reply); return GetVersionStub(data, reply);
default: default:
return IPCObjectStub::OnRemoteRequest(code, data, reply, option); return IPCObjectStub::OnRemoteRequest(code, data, reply, option);

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,4 +1,4 @@
# Copyright (c) 2021 Huawei Device Co., Ltd. # Copyright (c) 2022 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at