diff --git a/README.md b/README.md index 3fb133f985c280efa2a2cf24106123adab9678cc..d1c289689e0cfa2c0208e5c44bcbc717ec7bdd36 100644 --- a/README.md +++ b/README.md @@ -1,117 +1,83 @@ -# useriam_coauth +# Authentication Executor Management (auth_executor_mgr) -- [简介](#简介) -- [目录](#目录) -- [编译构建](#编译构建) - - [准备](#准备) - - [获取源码](#获取源码) - - [编译构建](#编译构建) -- [说明](#说明) - - [接口说明](#接口说明) - - [使用说明](#使用说明) -- [相关仓](#相关仓) +## Introduction -## 简介 +As a basic component of the Identity & Access Management (IAM) subsystem, Authentication Executor Management (auth_executor_mgr) manages and schedules authentication resources in the system. Currently, password authentication and facial authentication are supported. -**协同认证(coauth)**是用户IAM子系统的基础部件之一,提供系统内认证相关资源的统一管理和协同调度能力,当前支持口令认证和人脸认证的对接。 +The user authentication unit on the device is called authentication executor. -我们将设备上的一个用户身份认证单元,称为**认证执行器**。 +The auth_executor_mgr module provides a set of resource management APIs. After implementing these APIs, the authentication executor can connect to auth_executor_mgr to provide authentication capabilities for the system. -协同认证定义了一套**资源管理**接口,新增的认证执行器在实现了认证资源管理定义的接口后,可以对接到协同认证框架上,从而为系统提供相关身份认证能力。 +**Figure 1** auth_executor_mgr architecture -**图1** 协同认证架构图 +auth_executor_mgr_architecture.png -coauth架构图 +The OpenHarmony framework implements the auth_executor_mgr service and has encapsulated the collaborative scheduling and resource management APIs. Device vendors need to adapt some functions of the authentication executor management component to meet higher security requirements. The APIs that need to be adapted by device vendors are defined in the IAM common HDI. -如图所示,OpenHarmony框架已经实现了协同认证的系统服务,并对上封装了协同调度和资源管理的接口。协同认证部件内部分功能需要厂商适配来达到更高的安全性要求。需要南向厂商适配的接口,在用户IAM Common HDI中有定义。 - -## 目录 +## Directory Structure ```undefined -//base/user_iam/coauth -├── coauth.gni # 构建配置 -├── ohos.build # 组件描述文件 -├── frameworks # 框架代码 -├── interfaces # 对外接口存放目录 -│ └── innerkits # 对内部子系统暴露的头文件,供系统服务使用 -├── sa_profile # Service Ability 配置文件 -├── services # Service Ability 服务实现 -├── test # 测试代码存入目录 -└── utils # 工具代码存放目录 +//base/user_iam/auth_executor_mgr +├── common # Directory for storing the IAM common HDI +├── frameworks # Framework code +├── interfaces # Directory for storing external interfaces +│ └── innerkits # Header files exposed to the internal subsystem +├── sa_profile # Profile of the Service Ability +├── services # Implementation of Service Ability services +├── test # Directory for storing test code +├── utils # Directory for storing utility code +├── auth_executor_mgr.gni # Build configuration +└── bundle.json # Component description file ``` -## 编译构建 - - -### 准备 - -开发者需要在Linux上搭建编译环境: - -- [Ubuntu编译环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup-linux.md) -- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-setting.md) -- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-setting.md) - -### 获取源码 - -在Linux服务器上下载并解压一套源代码,源码获取方式参考[源码获取](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)。 -### 编译构建 +## Usage -开发者开发第一个应用程序可参考: +### Available APIs -- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md) +**Table 1** APIs for managing authentication resources -- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-running.md) - - -## 说明 - -### 接口说明 - -**表1** 资源管理接口 - -| 接口名 | 描述 | +| API | Description | | ------ | -------------------------------- | -| uint64_t Register(std::shared_ptr executorInfo, std::shared_ptr callback); | 注册接口,执行器传入基本信息和实现的回调函数 | -| void QueryStatus(AuthExecutor &executorInfo, std::shared_ptr callback); | 状态查询接口,查询当前执行器是否已经注册 | +| uint64_t Register(std::shared_ptr executorInfo, std::shared_ptr callback); | Registers an authentication executor to transfer basic authentication information.| +| void QueryStatus(AuthExecutor &executorInfo, std::shared_ptr callback); | Obtains the authentication executor status (whether the authentication executor has been registered).| -**表2** 执行器需要实现的回调接口 +**Table 2** APIs for executing authentication -| 接口名 | 描述 | +| API| Description | | ------ | -------------------------------- | -| virtual void OnMessengerReady(const sptr<IExecutorMessenger> &messenger); | 通知执行器信使可用,传入信使(用于后续协同认证与执行器通信) | -| virtual int32_t OnBeginExecute(uint64_t scheduleId, std::vector &publicKey, std::shared_ptr commandAttrs); | 通知执行器开始执行认证相关操作,commandAttrs中传入本次操作的属性 | -| virtual int32_t OnEndExecute(uint64_t scheduleId, std::shared_ptr consumerAttr); | 通知执行器结束本次操作 | -| virtual int32_t OnSetProperty(std::shared_ptr properties); | 设置属性信息 | -| virtual int32_t OnGetProperty(std::shared_ptr conditions, std::shared_ptr values); | 获取属性信息 | +| virtual void OnMessengerReady(const sptr<IExecutorMessenger> &messenger); | Notifies the authentication executor that the messenger is available and transfers the messenger for subsequent communication with the executor.| +| virtual int32_t OnBeginExecute(uint64_t scheduleId, std::vector &publicKey, std::shared_ptr commandAttrs); | Instructs the authentication executor to perform authentication-related operations. The operation attributes are passed in by **commandAttrs**.| +| virtual int32_t OnEndExecute(uint64_t scheduleId, std::shared_ptr consumerAttr); | Instructs the authentication executor to complete this operation.| +| virtual int32_t OnSetProperty(std::shared_ptr properties); | Sets property information.| +| virtual int32_t OnGetProperty(std::shared_ptr conditions, std::shared_ptr values); | Obtains property information.| -**表3** 信使函数 +**Table 3** APIs for managing the messenger -| 接口名 | 描述 | +| API | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| virtual int32_t SendData(uint64_t scheduleId, uint64_t transNum, int32_t srcType, int32_t dstType, std::shared_ptr<AuthMessage> msg) override; | 发送消息,消息源为执行器,目的端为协同认证框架,消息内容由执行器指定,比如返回人脸认证过程中的提示信息(光线过暗) | -| virtual int32_t Finish(uint64_t scheduleId, int32_t srcType, int32_t resultCode, std::shared_ptr finalResult) override; | 操作结束,消息源为执行器,目的端为协同认证框架,消息内容为本次操作的最终结果 | - +| virtual int32_t SendData(uint64_t scheduleId, uint64_t transNum, int32_t srcType, int32_t dstType, std::shared_ptr<AuthMessage> msg) override; | Sends a message from the authentication executor to the auth_executor_mgr. The message content is specified by the authentication executor, for example, a message indicating dark light during facial authentication.| +| virtual int32_t Finish(uint64_t scheduleId, int32_t srcType, int32_t resultCode, std::shared_ptr finalResult) override; | Sends a message from the authentication executor to the auth_executor_mgr to complete this operation. The message contains the result of the operation.| -### 使用说明 -- 协同认证SA提供执行器对接接口,各身份认证执行器调用资源管理接口完成认证执行器的注册 -- 需在可信执行环境内实现头文件```common\hal\interface\coauth_interface.h``` 中定义的接口,保证认证执行器信息不可篡改,并在可信执行环境内校验认证执行器返回的结果 +### Usage Guidelines -## 相关仓 +- The auth_executor_mgr SA provides interconnection APIs for the authentication executors. The authentication executors call the related API to register with the auth_executor_mgr. +- The APIs defined in the ```common\interface\coauth_interface.h``` header file must be implemented in a TEE. The authentication executor information cannot be tampered with, and the result returned by the authentication executor must be verified in the TEE. -**[useriam_coauth](https://gitee.com/openharmony-sig/useriam_coauth)** +## Repositories Involved -[useriam_useridm](https://gitee.com/openharmony-sig/useriam_useridm) +**[useriam_auth_executor_mgr](https://gitee.com/useriam_auth_executor_mgr/blob/master/README.md)** -[useriam_userauth](https://gitee.com/openharmony-sig/useriam_userauth) +[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm/blob/master/README.md) -[useriam_pinauth](https://gitee.com/openharmony-sig/useriam_pinauth) +[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth/blob/master/README.md) -[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) +[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth/blob/master/README.md) +useriam_faceauth diff --git a/README_ZH.md b/README_ZH.md index 92ef52a80c9ee55f95f9fb82dde4b8d0b38e032f..43b742ff488e73c0a882147ade9da5d443dea49f 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -78,13 +78,12 @@ ## 相关仓 -**[useriam_auth_executor_mgr](https://gitee.com/openharmony-sig/useriam_coauth)** +**[useriam_auth_executor_mgr](https://gitee.com/openharmony/useriam_auth_executor_mgr)** -[useriam_user_idm](https://gitee.com/openharmony-sig/useriam_useridm) +[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm) -[useriam_user_auth](https://gitee.com/openharmony-sig/useriam_userauth) +[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth) -[useriam_pin_auth](https://gitee.com/openharmony-sig/useriam_pinauth) - -[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) +[useriam_pin_auth](https://gitee.com/openharmony/useriam_pin_auth) +[useriam_faceauth](https://gitee.com/openharmony/useriam_faceauth) \ No newline at end of file diff --git a/figures/auth_executor_mgr_architecture.png b/figures/auth_executor_mgr_architecture.png new file mode 100644 index 0000000000000000000000000000000000000000..e7f0f691f2fcdf91fe42fbbecd18fad7f5e931b9 Binary files /dev/null and b/figures/auth_executor_mgr_architecture.png differ diff --git a/test/unittest/src/coauth_test.cpp b/test/unittest/src/coauth_test.cpp index 9c4d4463a3aeca2e06c7c6bc440497c268911912..82f761a21d53fd341fd6d550c10b6f409719e7bc 100644 --- a/test/unittest/src/coauth_test.cpp +++ b/test/unittest/src/coauth_test.cpp @@ -49,12 +49,97 @@ void CoAuthTest::TearDown() /** * @tc.name: UseriamUtTest001 - * @tc.desc: Test AuthType(PIN). + * @tc.desc: Test GetExecutorProp(FACE). * @tc.type: FUNC */ HWTEST_F(CoAuthTest, UseriamUtTest001, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest001 start"); + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest001 enter."); + AuthResPool::AuthAttributes conditions; + conditions.SetUint32Value(AUTH_TYPE, FACE); + conditions.SetBoolValue(AUTH_CONTROLLER, 0); + conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); + conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); + + std::vector val1; + val1.push_back(1); + conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); + + std::vector val2; + val2.push_back('5'); + conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); + + std::shared_ptr values = std::make_shared(); + int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); + sleep(5); + EXPECT_NE(0, ret); +} + +/** + * @tc.name: UseriamUtTest002 + * @tc.desc: Test GetExecutorProp(). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest002, TestSize.Level0) +{ + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest002 enter."); + AuthResPool::AuthAttributes conditions; + conditions.SetBoolValue(AUTH_CONTROLLER, 0); + conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); + conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); + + std::vector val1; + val1.push_back(1); + conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); + + std::vector val2; + val2.push_back('5'); + conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); + + std::shared_ptr values = nullptr; + int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); + sleep(5); + EXPECT_EQ(1, ret); +} + +/** + * @tc.name: UseriamUtTest003 + * @tc.desc: Test GetExecutorProp(PIN). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest003, TestSize.Level0) +{ + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest003 enter."); + AuthResPool::AuthAttributes conditions; + conditions.SetUint32Value(AUTH_TYPE, PIN); + conditions.SetBoolValue(AUTH_CONTROLLER, 0); + conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); + conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); + conditions.SetUint32Value(AUTH_PROPERTY_MODE, 1); + conditions.SetUint64Value(AUTH_TEMPLATE_ID, 1); + + std::vector val1; + val1.push_back(1); + conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); + + std::vector val2; + val2.push_back('5'); + conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); + + std::shared_ptr values = std::make_shared(); + int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); + sleep(5); + EXPECT_EQ(0, ret); +} + +/** + * @tc.name: UseriamUtTest004 + * @tc.desc: Test AuthType(PIN). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest004, TestSize.Level0) +{ + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest004 start"); std::shared_ptr executorInfo = std::make_shared(); executorInfo->SetAuthType(PIN); executorInfo->SetAuthAbility(1); @@ -100,13 +185,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest001, TestSize.Level0) /** - * @tc.name: UseriamUtTest002 + * @tc.name: UseriamUtTest005 * @tc.desc: Test empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest002, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest005, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest002 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest005 start"); std::shared_ptr executorInfo = std::make_shared(); executorInfo->SetAuthType(PIN); executorInfo->SetAuthAbility(1); @@ -124,13 +209,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest002, TestSize.Level0) EXPECT_LE(FAIL, ret); } /** - * @tc.name: UseriamUtTest003 + * @tc.name: UseriamUtTest006 * @tc.desc: Test AuthType(FACE). * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest003, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest006, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest003 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest006 start"); std::shared_ptr executorInfo = std::make_shared(); executorInfo->SetAuthType(FACE); executorInfo->SetAuthAbility(1); @@ -175,13 +260,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest003, TestSize.Level0) } /** - * @tc.name: UseriamUtTest004 + * @tc.name: UseriamUtTest007 * @tc.desc: Test publicKey error length. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest004, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest007, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest004 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest007 start"); std::shared_ptr executorInfo = std::make_shared(); executorInfo->SetAuthType(FACE); executorInfo->SetAuthAbility(1); @@ -226,13 +311,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest004, TestSize.Level0) } /** - * @tc.name: UseriamUtTest005 + * @tc.name: UseriamUtTest008 * @tc.desc: Test empty executorInfo and empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest005, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest008, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest005 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest008 start"); std::shared_ptr executorInfo = nullptr; std::shared_ptr callback = nullptr; uint64_t ret = AuthResPool::AuthExecutorRegistry::GetInstance().Register(executorInfo, callback); @@ -240,13 +325,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest005, TestSize.Level0) } /** - * @tc.name: UseriamUtTest006 + * @tc.name: UseriamUtTest009 * @tc.desc: Test AuthType(PIN). * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest006, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest009, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest006 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest009 start"); AuthResPool::AuthExecutor executorInfo; executorInfo.SetAuthType(PIN); executorInfo.SetAuthAbility(1); @@ -274,13 +359,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest006, TestSize.Level0) } /** - * @tc.name: UseriamUtTest007 + * @tc.name: UseriamUtTest0010 * @tc.desc: Test empty executorInfo and empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest007, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest010, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest007 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest010 start"); AuthResPool::AuthExecutor executorInfo; std::shared_ptr callback = nullptr; AuthResPool::AuthExecutorRegistry::GetInstance().QueryStatus(executorInfo, callback); @@ -288,13 +373,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest007, TestSize.Level0) } /** - * @tc.name: UseriamUtTest008 + * @tc.name: UseriamUtTest011 * @tc.desc: Test AuthType(FACE). * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest008, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest011, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest008 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest011 start"); AuthResPool::AuthExecutor executorInfo; executorInfo.SetAuthType(FACE); executorInfo.SetAuthAbility(1); @@ -321,13 +406,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest008, TestSize.Level0) SUCCEED(); } /** - * @tc.name: UseriamUtTest009 + * @tc.name: UseriamUtTest012 * @tc.desc: Test empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest009, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest012, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest009 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest012 start"); AuthResPool::AuthExecutor executorInfo; executorInfo.SetAuthType(FACE); executorInfo.SetAuthAbility(1); @@ -346,13 +431,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest009, TestSize.Level0) SUCCEED(); } /** - * @tc.name: UseriamUtTest010 + * @tc.name: UseriamUtTest013 * @tc.desc: Test empty authInfo and empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest010, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest013, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest010 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest013 start"); AuthInfo authInfo; std::shared_ptr callback = nullptr; CoAuth::GetInstance().BeginSchedule(1, authInfo, callback); @@ -360,13 +445,13 @@ HWTEST_F(CoAuthTest, UseriamUtTest010, TestSize.Level0) } /** - * @tc.name: UseriamUtTest011 + * @tc.name: UseriamUtTest014 * @tc.desc: Test normal value. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest011, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest014, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest011 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest014 start"); AuthInfo authInfo; std::string value = "packagedemo"; authInfo.SetPkgName(value); @@ -387,14 +472,15 @@ HWTEST_F(CoAuthTest, UseriamUtTest011, TestSize.Level0) CoAuth::GetInstance().BeginSchedule(1, authInfo, callback); SUCCEED(); } + /** - * @tc.name: UseriamUtTest012 + * @tc.name: UseriamUtTest015 * @tc.desc: Test empty callback. * @tc.type: FUNC */ -HWTEST_F(CoAuthTest, UseriamUtTest012, TestSize.Level0) +HWTEST_F(CoAuthTest, UseriamUtTest015, TestSize.Level0) { - COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest012 start"); + COAUTH_HILOGD(MODULE_INNERKIT, "UseriamUtTest015 start"); AuthInfo authInfo; std::string value = "packagedemo"; authInfo.SetPkgName(value); @@ -404,9 +490,14 @@ HWTEST_F(CoAuthTest, UseriamUtTest012, TestSize.Level0) SUCCEED(); } -HWTEST_F(CoAuthTest, UseriamUtTest013, TestSize.Level0) +/** + * @tc.name: UseriamUtTest016 + * @tc.desc: Test Cancel(). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest016, TestSize.Level0) { - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest013 enter."); + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest016 enter."); uint64_t scheduleId = 0; EXPECT_NE(0, CoAuth::GetInstance().Cancel(scheduleId)); @@ -414,9 +505,14 @@ HWTEST_F(CoAuthTest, UseriamUtTest013, TestSize.Level0) EXPECT_NE(0, CoAuth::GetInstance().Cancel(scheduleId)); } -HWTEST_F(CoAuthTest, UseriamUtTest014, TestSize.Level0) +/** + * @tc.name: UseriamUtTest017 + * @tc.desc: Test SetExecutorProp(). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest017, TestSize.Level0) { - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest014 enter."); + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest017 enter."); AuthResPool::AuthAttributes conditions; conditions.SetUint32Value(AUTH_TYPE, FACE); conditions.SetBoolValue(AUTH_CONTROLLER, 0); @@ -448,9 +544,14 @@ HWTEST_F(CoAuthTest, UseriamUtTest014, TestSize.Level0) SUCCEED(); } -HWTEST_F(CoAuthTest, UseriamUtTest015, TestSize.Level0) +/** + * @tc.name: UseriamUtTest018 + * @tc.desc: Test SetExecutorProp(). + * @tc.type: FUNC + */ +HWTEST_F(CoAuthTest, UseriamUtTest018, TestSize.Level0) { - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest015 enter."); + COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest018 enter."); AuthResPool::AuthAttributes conditions; conditions.SetUint32Value(AUTH_TYPE, FACE); conditions.SetBoolValue(AUTH_CONTROLLER, 0); @@ -469,76 +570,6 @@ HWTEST_F(CoAuthTest, UseriamUtTest015, TestSize.Level0) sleep(5); SUCCEED(); } - -HWTEST_F(CoAuthTest, UseriamUtTest016, TestSize.Level0) -{ - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest016 enter."); - AuthResPool::AuthAttributes conditions; - conditions.SetUint32Value(AUTH_TYPE, FACE); - conditions.SetBoolValue(AUTH_CONTROLLER, 0); - conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); - conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); - - std::vector val1; - val1.push_back(1); - conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); - - std::vector val2; - val2.push_back('5'); - conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); - - std::shared_ptr values = std::make_shared(); - int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); - sleep(5); - EXPECT_EQ(0, ret); -} - -HWTEST_F(CoAuthTest, UseriamUtTest017, TestSize.Level0) -{ - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest017 enter."); - AuthResPool::AuthAttributes conditions; - conditions.SetBoolValue(AUTH_CONTROLLER, 0); - conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); - conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); - - std::vector val1; - val1.push_back(1); - conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); - - std::vector val2; - val2.push_back('5'); - conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); - - std::shared_ptr values = nullptr; - int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); - sleep(5); - EXPECT_EQ(1, ret); -} - -HWTEST_F(CoAuthTest, UseriamUtTest018, TestSize.Level0) -{ - COAUTH_HILOGE(MODULE_SERVICE, "UseriamUtTest018 enter."); - AuthResPool::AuthAttributes conditions; - conditions.SetUint32Value(AUTH_TYPE, PIN); - conditions.SetBoolValue(AUTH_CONTROLLER, 0); - conditions.SetUint32Value(AUTH_SCHEDULE_MODE, 1); - conditions.SetUint64Value(AUTH_SCHEDULE_ID, 1); - conditions.SetUint32Value(AUTH_PROPERTY_MODE, 1); - conditions.SetUint64Value(AUTH_TEMPLATE_ID, 1); - - std::vector val1; - val1.push_back(1); - conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1); - - std::vector val2; - val2.push_back('5'); - conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2); - - std::shared_ptr values = std::make_shared(); - int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values); - sleep(5); - EXPECT_EQ(0, ret); -} } } } \ No newline at end of file