From 8a6322b7f87038ccc85488cbe4849f6a3e7f5f19 Mon Sep 17 00:00:00 2001 From: wangxu43 Date: Wed, 19 Jan 2022 00:08:17 +0800 Subject: [PATCH] Update structure Signed-off-by: wangxu43 --- OAT.xml | 2 +- bundle.json | 83 +++++++++++++++++++ frameworks/kitsimpl/src/userauth.cpp | 2 +- .../innerkits/js/ohos.UserIAM.userAuth.d.ts | 0 interfaces/innerkits/napi/BUILD.gn | 14 +--- .../innerkits/napi/include/auth_build.h | 0 .../innerkits/napi/include/auth_common.h | 0 .../napi/include/auth_hilog_wrapper.h | 0 .../innerkits/napi/include/auth_object.h | 0 .../innerkits/napi/include/authapi_callback.h | 0 .../innerkits/napi/include/result_convert.h | 3 +- .../innerkits/napi/include/user_auth_helper.h | 0 .../innerkits/napi/include/user_auth_impl.h | 0 interfaces/innerkits/napi/src/auth_build.cpp | 12 ++- .../innerkits/napi/src/auth_native_module.cpp | 0 .../innerkits/napi/src/authapi_callback.cpp | 1 + .../innerkits/napi/src/result_convert.cpp | 67 ++++++++------- .../innerkits/napi/src/user_auth_helper.cpp | 0 .../innerkits/napi/src/user_auth_impl.cpp | 0 interfaces/innerkits/native/BUILD.gn | 7 +- .../innerkits/native/include/iuser_auth.h | 0 .../native/include/iuserauth_callback.h | 0 .../innerkits/native/include/user_auth.h | 0 .../native/include/userauth_async_stub.h | 0 .../native/include/userauth_callback.h | 0 .../innerkits/native/include/userauth_info.h | 0 .../innerkits/native/include/userauth_proxy.h | 0 interfaces/kits/napi/BUILD.gn | 9 +- .../napi/include/user_auth_helper_north.h | 0 .../kits/napi/src/auth_native_module.cpp | 0 .../kits/napi/src/user_auth_helper_north.cpp | 0 ohos.build | 24 ------ sa_profile/{5201.xml => 922.xml} | 2 +- sa_profile/BUILD.gn | 4 +- services/BUILD.gn | 16 ++-- services/src/userauth_adapter.cpp | 26 +++--- services/src/userauth_async_proxy.cpp | 1 + services/src/userauth_datamgr.cpp | 0 services/src/userauth_excallback_impl.cpp | 6 +- services/src/userauth_service.cpp | 2 +- services/src/userauth_stub.cpp | 0 test/BUILD.gn | 2 +- test/unittest/BUILD.gn | 11 +-- userauth.gni | 4 +- utils/BUILD.gn | 2 +- 45 files changed, 177 insertions(+), 123 deletions(-) create mode 100644 bundle.json mode change 100644 => 100755 interfaces/innerkits/js/ohos.UserIAM.userAuth.d.ts mode change 100644 => 100755 interfaces/innerkits/napi/BUILD.gn mode change 100644 => 100755 interfaces/innerkits/napi/include/auth_build.h mode change 100644 => 100755 interfaces/innerkits/napi/include/auth_common.h mode change 100644 => 100755 interfaces/innerkits/napi/include/auth_hilog_wrapper.h mode change 100644 => 100755 interfaces/innerkits/napi/include/auth_object.h mode change 100644 => 100755 interfaces/innerkits/napi/include/authapi_callback.h mode change 100644 => 100755 interfaces/innerkits/napi/include/result_convert.h mode change 100644 => 100755 interfaces/innerkits/napi/include/user_auth_helper.h mode change 100644 => 100755 interfaces/innerkits/napi/include/user_auth_impl.h mode change 100644 => 100755 interfaces/innerkits/napi/src/auth_build.cpp mode change 100644 => 100755 interfaces/innerkits/napi/src/auth_native_module.cpp mode change 100644 => 100755 interfaces/innerkits/napi/src/authapi_callback.cpp mode change 100644 => 100755 interfaces/innerkits/napi/src/user_auth_helper.cpp mode change 100644 => 100755 interfaces/innerkits/napi/src/user_auth_impl.cpp mode change 100644 => 100755 interfaces/innerkits/native/BUILD.gn mode change 100644 => 100755 interfaces/innerkits/native/include/iuser_auth.h mode change 100644 => 100755 interfaces/innerkits/native/include/iuserauth_callback.h mode change 100644 => 100755 interfaces/innerkits/native/include/user_auth.h mode change 100644 => 100755 interfaces/innerkits/native/include/userauth_async_stub.h mode change 100644 => 100755 interfaces/innerkits/native/include/userauth_callback.h mode change 100644 => 100755 interfaces/innerkits/native/include/userauth_info.h mode change 100644 => 100755 interfaces/innerkits/native/include/userauth_proxy.h mode change 100644 => 100755 interfaces/kits/napi/BUILD.gn mode change 100644 => 100755 interfaces/kits/napi/include/user_auth_helper_north.h mode change 100644 => 100755 interfaces/kits/napi/src/auth_native_module.cpp mode change 100644 => 100755 interfaces/kits/napi/src/user_auth_helper_north.cpp delete mode 100755 ohos.build rename sa_profile/{5201.xml => 922.xml} (97%) mode change 100755 => 100644 services/src/userauth_datamgr.cpp mode change 100755 => 100644 services/src/userauth_stub.cpp diff --git a/OAT.xml b/OAT.xml index 55211e7b2..131151bd4 100755 --- a/OAT.xml +++ b/OAT.xml @@ -18,7 +18,7 @@ - + diff --git a/bundle.json b/bundle.json new file mode 100644 index 000000000..6b043c706 --- /dev/null +++ b/bundle.json @@ -0,0 +1,83 @@ +{ + "name": "@openharmony/user_auth", + "version": "3.1.0", + "description": "User Authentication capability", + "homePage": "https://gitee.com/openharmony", + "author": {}, + "repository": "", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath" : "base/user_iam/user_auth" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "user_auth", + "subsystem": "useriam", + "adapted_system_type": [ "standard" ], + "syscap": ["SystemCapability.UserIAM.UserAuth"], + "features": [], + "rom": "200KB", + "ram": "1500KB", + "deps": { + "components": [ + "hiviewdfx_hilog_native", + "ipc", + "safwk", + "samgr_standard", + "hilog", + "auth_executor_mgr" + ], + "third_party": [ + "openssl", + "googletest" + ] + }, + "build": { + "sub_component": [ + "//base/user_iam/user_auth/sa_profile:userauth_sa_profile", + "//base/user_iam/user_auth/services:userauthservice", + "//base/user_iam/user_auth/interfaces/kits/napi:userauthnorth" + ], + "inner_kits": [ + { + "type": "so", + "name": "//base/user_iam/user_auth/interfaces/innerkits/native:userauth_framework", + "header": { + "header_files": [ + "iuser_auth.h", + "iuserauth_callback.h", + "user_auth.h", + "userauth_async_stub.h", + "userauth_callback.h", + "userauth_info.h", + "userauth_proxy.h" + ], + "header_base": "//base/user_iam/user_auth/interfaces/innerkits/native/include" + } + }, + { + "type": "so", + "name": "//base/user_iam/user_auth/interfaces/innerkits/napi:userauth", + "header": { + "header_files": [ + "auth_build.h", + "auth_common.h", + "auth_hilog_wrapper.h", + "auth_object.h", + "authapi_callback.h", + "result_convert.h", + "user_auth_helper.h", + "user_auth_impl.h" + ], + "header_base": "//base/user_iam/user_auth/interfaces/innerkits/napi/include" + } + } + ], + "test": [ + "//base/user_iam/user_auth/test:userauth_native_test" + ] + } + } + } diff --git a/frameworks/kitsimpl/src/userauth.cpp b/frameworks/kitsimpl/src/userauth.cpp index 648e286b3..2d9f56358 100644 --- a/frameworks/kitsimpl/src/userauth.cpp +++ b/frameworks/kitsimpl/src/userauth.cpp @@ -39,7 +39,7 @@ sptr UserAuth::GetProxy() USERAUTH_HILOGE(MODULE_INNERKIT, "userauth Failed to get system manager"); return nullptr; } - sptr obj = sam->CheckSystemAbility(USERAUTH_SERVICE_SA_ID); + sptr obj = sam->CheckSystemAbility(SUBSYS_USERIAM_SYS_ABILITY_USERAUTH); if (obj == nullptr) { USERAUTH_HILOGE(MODULE_INNERKIT, "userauth Failed to get userauth manager service"); return nullptr; diff --git a/interfaces/innerkits/js/ohos.UserIAM.userAuth.d.ts b/interfaces/innerkits/js/ohos.UserIAM.userAuth.d.ts old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/BUILD.gn b/interfaces/innerkits/napi/BUILD.gn old mode 100644 new mode 100755 index 962003f5e..32e92deec --- a/interfaces/innerkits/napi/BUILD.gn +++ b/interfaces/innerkits/napi/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//build/ohos.gni") -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") config("userauth_public_config") { include_dirs = [ @@ -21,14 +21,6 @@ config("userauth_public_config") { } ohos_shared_library("userauth") { - include_dirs = [ - # "common/include", - # "//third_party/node/src", - # "//foundation/ace/napi/interfaces/kits", - # "//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include", - ] - - cflags = [ "-fPIC", "-g3", @@ -64,6 +56,6 @@ ohos_shared_library("userauth") { relative_install_dir = "module" - part_name = "userauth" - subsystem_name = "userauth" + part_name = "user_auth" + subsystem_name = "user_iam" } diff --git a/interfaces/innerkits/napi/include/auth_build.h b/interfaces/innerkits/napi/include/auth_build.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/auth_common.h b/interfaces/innerkits/napi/include/auth_common.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/auth_hilog_wrapper.h b/interfaces/innerkits/napi/include/auth_hilog_wrapper.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/auth_object.h b/interfaces/innerkits/napi/include/auth_object.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/authapi_callback.h b/interfaces/innerkits/napi/include/authapi_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/result_convert.h b/interfaces/innerkits/napi/include/result_convert.h old mode 100644 new mode 100755 index 28a59460e..fd7829c66 --- a/interfaces/innerkits/napi/include/result_convert.h +++ b/interfaces/innerkits/napi/include/result_convert.h @@ -52,8 +52,9 @@ private: void SetPropertyBigint(napi_env env, napi_value &jsObject, uint64_t value, std::string key); std::string NapiGetValueString(napi_env env, napi_value value); napi_value GetNapiValue(napi_env env, const std::string keyChar, napi_value object); + std::vector GetCppArrayUint32(napi_env env, napi_value value); }; } // namespace UserAuth } // namespace UserIAM } // namespace OHOS -#endif // RESULT_CONVERT_H \ No newline at end of file +#endif // RESULT_CONVERT_H diff --git a/interfaces/innerkits/napi/include/user_auth_helper.h b/interfaces/innerkits/napi/include/user_auth_helper.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/include/user_auth_impl.h b/interfaces/innerkits/napi/include/user_auth_impl.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/src/auth_build.cpp b/interfaces/innerkits/napi/src/auth_build.cpp old mode 100644 new mode 100755 index 5cd3ad277..ff107c6ec --- a/interfaces/innerkits/napi/src/auth_build.cpp +++ b/interfaces/innerkits/napi/src/auth_build.cpp @@ -15,6 +15,7 @@ #include "auth_build.h" +#include "securec.h" #include "auth_common.h" #include "auth_hilog_wrapper.h" #include "auth_object.h" @@ -247,7 +248,6 @@ void AuthBuild::AuthCallBackResult(napi_env env, AuthInfo *authInfo) uint64_t AuthBuild::GetUint8ArrayTo64(napi_env env, napi_value value) { napi_typedarray_type arraytype; - std::string challenge; size_t length = 0; napi_value buffer = nullptr; size_t offset = 0; @@ -270,9 +270,13 @@ uint64_t AuthBuild::GetUint8ArrayTo64(napi_env env, napi_value value) HILOG_INFO(" offset is =============>%{public}d", offset); return 0; } - std::vector result(data, data+length); - challenge.assign(result.begin(), result.end()); - uint64_t resultUint64 = atol(challenge.c_str()); + uint64_t resultUint64; + HILOG_INFO("data len = %{public}u", length); + if (memcpy_s(&resultUint64, sizeof(resultUint64), data, length) != EOK) { + HILOG_INFO("memcpy_s fail"); + return 0; + } + HILOG_INFO("resultUint64 = %{public}llu", resultUint64); return resultUint64; } diff --git a/interfaces/innerkits/napi/src/auth_native_module.cpp b/interfaces/innerkits/napi/src/auth_native_module.cpp old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/src/authapi_callback.cpp b/interfaces/innerkits/napi/src/authapi_callback.cpp old mode 100644 new mode 100755 index 09aa6ed36..89f8a2fb3 --- a/interfaces/innerkits/napi/src/authapi_callback.cpp +++ b/interfaces/innerkits/napi/src/authapi_callback.cpp @@ -140,6 +140,7 @@ void AuthApiCallback::onAcquireInfo(const int32_t module, const uint32_t acquire void AuthApiCallback::onResult(const int32_t result, const AuthResult extraInfo) { + HILOG_INFO("AuthApiCallback onResult enter"); napi_status status; if (userInfo_ != nullptr) { HILOG_INFO("AuthApiCallback onResult userInfo_"); diff --git a/interfaces/innerkits/napi/src/result_convert.cpp b/interfaces/innerkits/napi/src/result_convert.cpp index 8f17ff8f2..df8649b53 100644 --- a/interfaces/innerkits/napi/src/result_convert.cpp +++ b/interfaces/innerkits/napi/src/result_convert.cpp @@ -246,47 +246,52 @@ int32_t ResultConvert::GetInt32ValueByKey(napi_env env, napi_value jsObject, std return NapiGetValueInt32(env, value); } +std::vector ResultConvert::GetCppArrayUint32(napi_env env, napi_value value) +{ + uint32_t arrayLength = 0; + napi_get_array_length(env, value, &arrayLength); + if (arrayLength == 0) { + HILOG_ERROR("%{public}s The array is empty.", __func__); + return std::vector(); + } + std::vector paramArrays; + for (size_t i = 0; i < arrayLength; i++) { + napi_value napiElement = nullptr; + napi_get_element(env, value, i, &napiElement); + + napi_valuetype napiValueType = napi_undefined; + napi_typeof(env, napiElement, &napiValueType); + if (napiValueType != napi_number) { + HILOG_ERROR("%{public}s Wrong argument type. Numbers expected.", __func__); + return std::vector(); + } + uint32_t napiValue = 0; + napi_get_value_uint32(env, napiElement, &napiValue); + paramArrays.push_back(napiValue); + } + return paramArrays; +} + std::vector ResultConvert::GetInt32ArrayValueByKey(napi_env env, napi_value jsObject, std::string key) { napi_status status; napi_value array = GetNapiValue(env, key.c_str(), jsObject); - std::vector values; if (array == nullptr) { - return values; + return std::vector(); } - std::vectorRetNull = {0}; - napi_typedarray_type arraytype; - size_t length = 0; - napi_value buffer = nullptr; - size_t offset = 0; - uint8_t *data = nullptr; - bool isTypedArray = false; - status = napi_is_typedarray(env, array, &isTypedArray); + bool isArray = false; + status = napi_is_array(env, array, &isArray); if (status != napi_ok) { - HILOG_INFO("napi_is_typedarray is failed"); + HILOG_INFO("napi_is_array is failed"); + return std::vector(); } - if (isTypedArray) { + if (isArray) { HILOG_INFO("args[PIN_PARAMS_ONE] is a array"); } else { - HILOG_INFO("args[PIN_PARAMS_ONE] is not a uint8array"); - return RetNull; - } - status = napi_get_typedarray_info(env, array, &arraytype, &length, reinterpret_cast(&data), &buffer, &offset); - if (status != napi_ok) { - HILOG_INFO("napi_get_typedarray_info is failed"); + HILOG_INFO("args[PIN_PARAMS_ONE] is not a array"); + return std::vector(); } - if (arraytype == napi_uint32_array) { - HILOG_INFO("InputerImpl, OnSetData get uint8 array "); - } else { - HILOG_ERROR("InputerImpl, OnSetData get uint8 array error"); - return RetNull; - } - if (offset != 0) { - HILOG_INFO(" offset is =============>%{public}d",offset); - return RetNull; - } - std::vectorresult(data, data + length); - return result; + return GetCppArrayUint32(env, array); } std::string ResultConvert::NapiGetValueString(napi_env env, napi_value value) @@ -358,4 +363,4 @@ napi_value ResultConvert::GetNapiValue(napi_env env, const std::string keyChar, } } // namespace UserAuth } // namespace UserIAM -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/interfaces/innerkits/napi/src/user_auth_helper.cpp b/interfaces/innerkits/napi/src/user_auth_helper.cpp old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/napi/src/user_auth_impl.cpp b/interfaces/innerkits/napi/src/user_auth_impl.cpp old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/BUILD.gn b/interfaces/innerkits/native/BUILD.gn old mode 100644 new mode 100755 index 39b9b476a..cdcbcfeb0 --- a/interfaces/innerkits/native/BUILD.gn +++ b/interfaces/innerkits/native/BUILD.gn @@ -11,12 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") config("userauth_private_config") { include_dirs = [ - "//utils/system/safwk/napi/include", - #"${userauth_frameworks_path}/kitsimpl/include", + "//utils/system/safwk/native/include", "//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include", ] } @@ -41,7 +40,7 @@ ohos_shared_library("userauth_framework") { deps = [ "//utils/native/base:utils", - "//base/useriam/coauth/interfaces/innerkits:coauth_framework", + "//base/user_iam/auth_executor_mgr/interfaces/innerkits:coauth_framework", ] external_deps = [ diff --git a/interfaces/innerkits/native/include/iuser_auth.h b/interfaces/innerkits/native/include/iuser_auth.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/iuserauth_callback.h b/interfaces/innerkits/native/include/iuserauth_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/user_auth.h b/interfaces/innerkits/native/include/user_auth.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/userauth_async_stub.h b/interfaces/innerkits/native/include/userauth_async_stub.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/userauth_callback.h b/interfaces/innerkits/native/include/userauth_callback.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/userauth_info.h b/interfaces/innerkits/native/include/userauth_info.h old mode 100644 new mode 100755 diff --git a/interfaces/innerkits/native/include/userauth_proxy.h b/interfaces/innerkits/native/include/userauth_proxy.h old mode 100644 new mode 100755 diff --git a/interfaces/kits/napi/BUILD.gn b/interfaces/kits/napi/BUILD.gn old mode 100644 new mode 100755 index 1c027f26f..bcec5cfe2 --- a/interfaces/kits/napi/BUILD.gn +++ b/interfaces/kits/napi/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//build/ohos.gni") -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") import("//build/lite/config/component/lite_component.gni") ## Build userauth.so {{{ @@ -36,7 +36,7 @@ ohos_shared_library("userauthnorth") { deps = [ "//foundation/ace/napi:ace_napi", - "//base/useriam/userauth/interfaces/innerkits/napi:userauth", + "//base/user_iam/user_auth/interfaces/innerkits/napi:userauth", "${userauth_innerkits_path}/native:userauth_framework" ] @@ -53,7 +53,6 @@ ohos_shared_library("userauthnorth") { public_deps = [] relative_install_dir = "module" - part_name = "userauth" - subsystem_name = "userauth" + part_name = "user_auth" + subsystem_name = "useriam" } -## Build userauth.so }}} diff --git a/interfaces/kits/napi/include/user_auth_helper_north.h b/interfaces/kits/napi/include/user_auth_helper_north.h old mode 100644 new mode 100755 diff --git a/interfaces/kits/napi/src/auth_native_module.cpp b/interfaces/kits/napi/src/auth_native_module.cpp old mode 100644 new mode 100755 diff --git a/interfaces/kits/napi/src/user_auth_helper_north.cpp b/interfaces/kits/napi/src/user_auth_helper_north.cpp old mode 100644 new mode 100755 diff --git a/ohos.build b/ohos.build deleted file mode 100755 index 85389d342..000000000 --- a/ohos.build +++ /dev/null @@ -1,24 +0,0 @@ -{ - "subsystem": "useriam", - "parts": { - "userauth": { - "variants": [ - "wearable", - "phone" - ], - "module_list": [ - "//base/useriam/userauth/sa_profile:userauth_sa_profile", - "//base/useriam/userauth/services:userauthservice", - "//base/useriam/userauth/interfaces/innerkits/native:userauth_framework", - "//base/useriam/userauth/interfaces/kits/napi:userauthnorth", - "//base/useriam/userauth/interfaces/innerkits/napi:userauth" - ], - "inner_kits": [ - - ], - "test_list": [ - "//base/useriam/userauth/test:userauth_native_test" - ] - } - } -} diff --git a/sa_profile/5201.xml b/sa_profile/922.xml similarity index 97% rename from sa_profile/5201.xml rename to sa_profile/922.xml index e4c74ff5b..57f9f8e67 100644 --- a/sa_profile/5201.xml +++ b/sa_profile/922.xml @@ -15,7 +15,7 @@ useriam - 5201 + 922 libuserauthservice.z.so true false diff --git a/sa_profile/BUILD.gn b/sa_profile/BUILD.gn index 5408fc97c..363274a1c 100644 --- a/sa_profile/BUILD.gn +++ b/sa_profile/BUILD.gn @@ -11,11 +11,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") import("//build/ohos/sa_profile/sa_profile.gni") import("//build/ohos.gni") ohos_sa_profile("userauth_sa_profile") { - sources = [ "5201.xml" ] + sources = [ "922.xml" ] part_name = "${userauth_native_part_name}" } diff --git a/services/BUILD.gn b/services/BUILD.gn index af1e0c0e8..2e3e582fd 100755 --- a/services/BUILD.gn +++ b/services/BUILD.gn @@ -11,16 +11,14 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") config("userauth_private_config") { include_dirs = [ "include", - "//base/useriam/coauth/common/interface", - # "//utils/system/safwk/native/include", - # "//third_party/openssl/include/openssl", - # "//foundation/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include", - ] + "//base/user_iam/auth_executor_mgr/common/interface", + "//utils/system/safwk/native/include", + ] } ohos_shared_library("userauthservice") { @@ -41,14 +39,14 @@ ohos_shared_library("userauthservice") { ] deps = [ - "//base/useriam/coauth/interfaces/innerkits:coauth_framework", - "//base/useriam/useridm/interfaces/innerkits:useridm_framework", + "//base/user_iam/auth_executor_mgr/interfaces/innerkits:coauth_framework", + "//base/user_iam/user_idm/interfaces/innerkits:useridm_framework", "//third_party/openssl:libcrypto_static", "${userauth_innerkits_path}/native:userauth_framework", "//drivers/peripheral/display/hal:hdi_display_device", "//utils/native/base:utils", "//base/startup/syspara_lite/interfaces/innerkits/native/syspara:syspara", - "//base/useriam/coauth/common:useriam_common_lib", + "//base/user_iam/auth_executor_mgr/common:useriam_common_lib", ] external_deps = [ diff --git a/services/src/userauth_adapter.cpp b/services/src/userauth_adapter.cpp index 6e95b3cc1..47cad8775 100644 --- a/services/src/userauth_adapter.cpp +++ b/services/src/userauth_adapter.cpp @@ -26,7 +26,7 @@ namespace OHOS { namespace UserIAM { namespace UserAuth { -const int32_t cUserId = 12345; +const int32_t cUserId = 0; const uint64_t cCallerUID = 0; UserAuthAdapter &UserAuthAdapter::GetInstance() @@ -83,9 +83,9 @@ void UserAuthAdapter::SetPropAuthInfo(uint64_t callerUID, std::string pkgName, i USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetPropAuthInfo is end!"); } int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, - uint64_t callerUID, std::string pkgName, - SetPropertyRequest requset, std::vector templateIds, - std::shared_ptr &setPropCallback) + uint64_t callerUID, std::string pkgName, + SetPropertyRequest requset, std::vector templateIds, + std::shared_ptr &setPropCallback) { uint32_t value; int32_t ret = authAttributes.SetUint32Value(AUTH_TYPE, requset.authType); @@ -140,7 +140,7 @@ void UserAuthAdapter::GetPropAuthInfoCoauth(uint64_t callerUID, std::string pkgN sptr& callback) { USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is start!"); - USERAUTH_HILOGD(MODULE_SERVICE, "GetPropertyRequest requset key is %{public}u!", requset.keys.front()); + std::shared_ptr getInfoCallback = std::make_shared(callback, callerUID, pkgName, resultCode, authToken, requset); @@ -287,7 +287,6 @@ int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUID, std::string pkgName result.result = ret; return ret; } - USERAUTH_HILOGD(MODULE_SERVICE, "GetPropertyRequest requset key is %{public}u!", requset.keys.front()); if (GetEachExecutorProp(requset, result, value, pAuthAttributes) != SUCCESS) { return ret; } @@ -300,10 +299,8 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut { uint64_t tmpValue; int32_t ret = SUCCESS; - for (size_t i = 0; i < requset.keys.size(); i++) { - //for (std::vector::const_iterator iter = requset.keys.begin(); iter != requset.keys.end(); ++iter) { - USERAUTH_HILOGD(MODULE_SERVICE, "GetPropertyRequest *iter is %{public}u!", requset.keys[i]); - switch (requset.keys[i]) { + for (std::vector::const_iterator iter = requset.keys.begin(); iter != requset.keys.end(); ++iter) { + switch (*iter) { case AUTH_SUB_TYPE: ret = pAuthAttributes->GetUint64Value(AUTH_SUBTYPE, tmpValue); if (ret != SUCCESS) { @@ -314,7 +311,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut value = static_cast(tmpValue); result.authSubType = static_cast(value); break; - case AUTH_REMAIN_COUNT: + case REMAIN_TIMES: ret = pAuthAttributes->GetUint32Value(AUTH_REMAIN_COUNT, result.remainTimes); if (ret != SUCCESS) { USERAUTH_HILOGE(MODULE_SERVICE, "GetUint32Value->AUTH_REMAIN_COUNT ERROR!"); @@ -322,7 +319,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut return ret; } break; - case AUTH_REMAIN_TIME: + case FREEZING_TIME: ret = pAuthAttributes->GetUint32Value(AUTH_REMAIN_TIME, result.freezingTime); if (ret != SUCCESS) { USERAUTH_HILOGE(MODULE_SERVICE, "GetUint32Value->AUTH_REMAIN_TIME ERROR!"); @@ -332,10 +329,11 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut break; default: USERAUTH_HILOGE(MODULE_SERVICE, "The key to get ExecutorProp is invalid."); - result.result = INVALID_PARAMETERS; - return INVALID_PARAMETERS; + break; } } + USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthAdapter::GetEachExecutorProp %{public}ull:%{public}u:%{public}u", + result.authSubType, result.remainTimes, result.freezingTime); return ret; } diff --git a/services/src/userauth_async_proxy.cpp b/services/src/userauth_async_proxy.cpp index c0a52546e..86bf8bb8f 100755 --- a/services/src/userauth_async_proxy.cpp +++ b/services/src/userauth_async_proxy.cpp @@ -207,6 +207,7 @@ bool UserAuthAsyncProxy::SendRequest(uint32_t code, MessageParcel &data, Message USERAUTH_HILOGE(MODULE_SERVICE, "userauth failed to SendRequest.result = %{public}d", result); return false; } + USERAUTH_HILOGD(MODULE_SERVICE, "userauthAsyncProxy SendRequest end"); return true; } } // namespace UserAuth diff --git a/services/src/userauth_datamgr.cpp b/services/src/userauth_datamgr.cpp old mode 100755 new mode 100644 diff --git a/services/src/userauth_excallback_impl.cpp b/services/src/userauth_excallback_impl.cpp index d05b68eb4..95e2eea71 100644 --- a/services/src/userauth_excallback_impl.cpp +++ b/services/src/userauth_excallback_impl.cpp @@ -72,8 +72,9 @@ void UserAuthCallbackImplSetPropFreez::OnResult(uint32_t result, std::vectortemplateId; - USERAUTH_HILOGD(MODULE_SERVICE, "GetPropertyRequest requset key is %{public}u!", requset_.keys.front()); ret = UserAuthAdapter::GetInstance().GetExecutorProp(callerUid_, pkgName_, tmp, requset_, executorProperty); if (ret != SUCCESS) { executorProperty.freezingTime = 0; diff --git a/services/src/userauth_service.cpp b/services/src/userauth_service.cpp index 475e74004..68475ae19 100644 --- a/services/src/userauth_service.cpp +++ b/services/src/userauth_service.cpp @@ -22,7 +22,7 @@ namespace OHOS { namespace UserIAM { namespace UserAuth { -REGISTER_SYSTEM_ABILITY_BY_ID(UserAuthService, USERAUTH_SERVICE_SA_ID, true); +REGISTER_SYSTEM_ABILITY_BY_ID(UserAuthService, SUBSYS_USERIAM_SYS_ABILITY_USERAUTH, true); UserAuthService::UserAuthService(int32_t systemAbilityId, bool runOnCreate) : SystemAbility(systemAbilityId, runOnCreate) diff --git a/services/src/userauth_stub.cpp b/services/src/userauth_stub.cpp old mode 100755 new mode 100644 diff --git a/test/BUILD.gn b/test/BUILD.gn index 4afefefed..48efc6aaf 100644 --- a/test/BUILD.gn +++ b/test/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") import("//build/test.gni") group("userauth_native_test") { diff --git a/test/unittest/BUILD.gn b/test/unittest/BUILD.gn index c21ccccdf..c5d5a54ef 100644 --- a/test/unittest/BUILD.gn +++ b/test/unittest/BUILD.gn @@ -12,7 +12,7 @@ # limitations under the License. import("//build/ohos.gni") import("//build/test.gni") -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") module_output_path = "${userauth_native_part_name}/UserAuth_test" @@ -24,7 +24,6 @@ config("module_private_config") { include_dirs = [ "include", "//utils/system/safwk/native/include", - #"//base/distributeddatamgr/distributeddatamgr/frameworks/innerkitsimpl/distributeddatafwk/include", ] } @@ -36,10 +35,10 @@ ohos_unittest("unittest_test") { include_dirs = [ "include", - #"//base/useriam/useridm/unittest/include", + #"//base/user_iam/user_idm/unittest/include", "//out/hi3516dv300/innerkits/ohos-arm/ipc/ipc_single/include", - "//base/useriam/userauth/interfaces/innerkits/include", - #"//base/useriam/useridm/services/include", + "//base/user_iam/user_auth/interfaces/innerkits/include", + #"//base/user_iam/user_idm/services/include", ] configs = [ @@ -52,8 +51,6 @@ ohos_unittest("unittest_test") { "//drivers/peripheral/display/hal:hdi_display_device", "//third_party/googletest:gtest_main", "//utils/native/base:utils", - #"//base/useriam/userauth/interfaces/innerkits/userauth:userauth_inner", - #"//base/useriam/userauth/services/userauthservice/adapter:userauth_adapter", ] external_deps = [ diff --git a/userauth.gni b/userauth.gni index 84687c17f..22f1ee9a5 100755 --- a/userauth.gni +++ b/userauth.gni @@ -13,9 +13,9 @@ import("//build/ohos.gni") -userauth_native_part_name = "userauth" +userauth_native_part_name = "user_auth" -userauth_root_path = "//base/useriam/userauth" +userauth_root_path = "//base/user_iam/user_auth" userauth_service_path = "${userauth_root_path}/services" diff --git a/utils/BUILD.gn b/utils/BUILD.gn index 5149a5bcf..61db81bec 100644 --- a/utils/BUILD.gn +++ b/utils/BUILD.gn @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import("//base/useriam/userauth/userauth.gni") +import("//base/user_iam/user_auth/userauth.gni") config("utils_config") { include_dirs = [ -- Gitee