Merge pull request !101 from 马腾飞/master
This commit is contained in:
openharmony_ci
2022-03-18 09:02:31 +00:00
committed by Gitee
4 changed files with 201 additions and 205 deletions
+54 -88
View File
@@ -1,117 +1,83 @@
# useriam_coauth
- [简介](#简介)
- [目录](#目录)
- [编译构建](#编译构建)
- [准备](#准备)
- [获取源码](#获取源码)
- [编译构建](#编译构建)
- [说明](#说明)
- [接口说明](#接口说明)
- [使用说明](#使用说明)
- [相关仓](#相关仓)
## 简介
**协同认证(coauth)**是用户IAM子系统的基础部件之一,提供系统内认证相关资源的统一管理和协同调度能力,当前支持口令认证和人脸认证的对接。
我们将设备上的一个用户身份认证单元,称为**认证执行器**。
协同认证定义了一套**资源管理**接口,新增的认证执行器在实现了认证资源管理定义的接口后,可以对接到协同认证框架上,从而为系统提供相关身份认证能力。
**图1** 协同认证架构图
<img src="figures/coauth架构图.png" alt="coauth架构图" style="zoom:80%;" />
# Authentication Executor Management (auth_executor_mgr)
如图所示,OpenHarmony框架已经实现了协同认证的系统服务,并对上封装了协同调度和资源管理的接口。协同认证部件内部分功能需要厂商适配来达到更高的安全性要求。需要南向厂商适配的接口,在用户IAM Common HDI中有定义。
## 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.
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
<img src="figures/auth_executor_mgr_architecture.png" alt="auth_executor_mgr_architecture.png" style="zoom:80%;" />
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.
## 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
```
## 编译构建
## Usage
### 准备
### Available APIs
开发者需要在Linux上搭建编译环境:
**Table 1** APIs for managing authentication resources
- [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)。
### 编译构建
开发者开发第一个应用程序可参考:
- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3518-running.md)
- [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<AuthExecutor> executorInfo, std::shared_ptr<ExecutorCallback> callback); | 注册接口,执行器传入基本信息和实现的回调函数 |
| void QueryStatus(AuthExecutor &executorInfo, std::shared_ptr<QueryCallback> callback); | 状态查询接口,查询当前执行器是否已经注册 |
| uint64_t Register(std::shared_ptr<AuthExecutor> executorInfo, std::shared_ptr<ExecutorCallback> callback); | Registers an authentication executor to transfer basic authentication information.|
| void QueryStatus(AuthExecutor &executorInfo, std::shared_ptr<QueryCallback> 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&lt;IExecutorMessenger&gt; &amp;messenger); | 通知执行器信使可用,传入信使(用于后续协同认证与执行器通信) |
| virtual int32_t OnBeginExecute(uint64_t scheduleId, std::vector<uint8_t> &publicKey, std::shared_ptr<AuthAttributes> commandAttrs); | 通知执行器开始执行认证相关操作,commandAttrs中传入本次操作的属性 |
| virtual int32_t OnEndExecute(uint64_t scheduleId, std::shared_ptr<AuthAttributes> consumerAttr); | 通知执行器结束本次操作 |
| virtual int32_t OnSetProperty(std::shared_ptr<AuthAttributes> properties); | 设置属性信息 |
| virtual int32_t OnGetProperty(std::shared_ptr<AuthAttributes> conditions, std::shared_ptr<AuthAttributes> values); | 获取属性信息 |
| virtual void OnMessengerReady(const sptr&lt;IExecutorMessenger&gt; &amp;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<uint8_t> &publicKey, std::shared_ptr<AuthAttributes> 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<AuthAttributes> consumerAttr); | Instructs the authentication executor to complete this operation.|
| virtual int32_t OnSetProperty(std::shared_ptr<AuthAttributes> properties); | Sets property information.|
| virtual int32_t OnGetProperty(std::shared_ptr<AuthAttributes> conditions, std::shared_ptr<AuthAttributes> 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&lt;AuthMessage&gt; msg) override; | 发送消息,消息源为执行器,目的端为协同认证框架,消息内容由执行器指定,比如返回人脸认证过程中的提示信息(光线过暗) |
| virtual int32_t Finish(uint64_t scheduleId, int32_t srcType, int32_t resultCode, std::shared_ptr<AuthAttributes> finalResult) override; | 操作结束,消息源为执行器,目的端为协同认证框架,消息内容为本次操作的最终结果 |
| virtual int32_t SendData(uint64_t scheduleId, uint64_t transNum, int32_t srcType, int32_t dstType, std::shared_ptr&lt;AuthMessage&gt; 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<AuthAttributes> 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.|
### 使用说明
### Usage Guidelines
- 协同认证SA提供执行器对接接口,各身份认证执行器调用资源管理接口完成认证执行器的注册
- 需在可信执行环境内实现头文件```common\hal\interface\coauth_interface.h``` 中定义的接口,保证认证执行器信息不可篡改,并在可信执行环境内校验认证执行器返回的结果
- 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.
## 相关仓
## Repositories Involved
**[useriam_coauth](https://gitee.com/openharmony-sig/useriam_coauth)**
**[useriam_auth_executor_mgr](https://gitee.com/useriam_auth_executor_mgr/blob/master/README.md)**
[useriam_useridm](https://gitee.com/openharmony-sig/useriam_useridm)
[useriam_user_idm](https://gitee.com/openharmony/useriam_user_idm/blob/master/README.md)
[useriam_userauth](https://gitee.com/openharmony-sig/useriam_userauth)
[useriam_user_auth](https://gitee.com/openharmony/useriam_user_auth/blob/master/README.md)
[useriam_pinauth](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/blob/master/README.md)
useriam_faceauth
+5 -6
View File
@@ -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)
Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

+142 -111
View File
@@ -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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> values = std::make_shared<AuthResPool::AuthAttributes>();
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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> 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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> values = std::make_shared<AuthResPool::AuthAttributes>();
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<AuthResPool::AuthExecutor> executorInfo = std::make_shared<AuthResPool::AuthExecutor>();
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<AuthResPool::AuthExecutor> executorInfo = std::make_shared<AuthResPool::AuthExecutor>();
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<AuthResPool::AuthExecutor> executorInfo = std::make_shared<AuthResPool::AuthExecutor>();
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<AuthResPool::AuthExecutor> executorInfo = std::make_shared<AuthResPool::AuthExecutor>();
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<AuthResPool::AuthExecutor> executorInfo = nullptr;
std::shared_ptr<AuthResPool::ExecutorCallback> 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<AuthResPool::QueryCallback> 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<CoAuthCallback> 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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> values = std::make_shared<AuthResPool::AuthAttributes>();
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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> 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<uint64_t> val1;
val1.push_back(1);
conditions.SetUint64ArrayValue(AUTH_TEMPLATE_ID_LIST, val1);
std::vector<uint8_t> val2;
val2.push_back('5');
conditions.SetUint8ArrayValue(AUTH_CALLER_NAME, val2);
std::shared_ptr<AuthResPool::AuthAttributes> values = std::make_shared<AuthResPool::AuthAttributes>();
int32_t ret = CoAuth::GetInstance().GetExecutorProp(conditions, values);
sleep(5);
EXPECT_EQ(0, ret);
}
}
}
}