Merge pull request !17 from 韩震/master
This commit is contained in:
openharmony_ci
2022-02-07 04:11:19 +00:00
committed by Gitee
4 changed files with 37 additions and 28 deletions
@@ -44,9 +44,9 @@ public:
private:
class UserAuthDeathRecipient : public IRemoteObject::DeathRecipient {
public:
UserAuthDeathRecipient() = default;
~UserAuthDeathRecipient() = default;
void OnRemoteDied(const wptr<IRemoteObject>& remote) override;
UserAuthDeathRecipient() = default;
~UserAuthDeathRecipient() = default;
void OnRemoteDied(const wptr<IRemoteObject>& remote) override;
private:
DISALLOW_COPY_AND_MOVE(UserAuthDeathRecipient);
@@ -23,12 +23,12 @@
namespace OHOS {
namespace UserIAM {
namespace UserAuth {
// 认证的类型(口令,人脸)
// Type of authentication (password, face)
enum AuthType: uint32_t {
PIN = 1,
FACE = 2,
};
// 认证子类型(2D人脸,3D人脸...)
// Authentication subtype (2D face, 3D face...)
enum AuthSubType: uint64_t {
/**
* Authentication sub type six number pin.
@@ -51,7 +51,7 @@ enum AuthSubType: uint64_t {
*/
FACE_3D = 20001
};
// 认证结果可信等级
// Certification result confidence level
enum AuthTurstLevel: uint32_t {
// level 1-4
ATL1 = 10000,
@@ -59,48 +59,50 @@ enum AuthTurstLevel: uint32_t {
ATL3 = 30000,
ATL4 = 40000
};
// 执行器属性列表
// Actuator get property list
enum GetPropertyType: uint32_t {
// 认证子类型(此时认证类型已确认)
// Authentication subtype (at this point the authentication type has been confirmed)
AUTH_SUB_TYPE = 1,
// 剩余认证次数
// Remaining authentication times
REMAIN_TIMES = 2,
// 冻结时间
// Freeze time
FREEZING_TIME = 3,
};
// 获得属性请求
// get attribute request
struct GetPropertyRequest {
AuthType authType;
// GetPropertyType
std::vector<uint32_t> keys;
};
// 执行器属性
// Actuator properties
struct ExecutorProperty {
int32_t result;
AuthSubType authSubType;
uint32_t remainTimes;
uint32_t freezingTime;
};
// 执行器属性列表
// Actuator property mode list
enum AuthPropertyMode: uint32_t {
PROPERMODE_DELETE = 0,
PROPERMODE_GET = 1,
PROPERMODE_SET = 2,
PROPERMODE_FREEZE = 3,
PROPERMODE_UNFREEZE = 4,
PROPERMODE_DELETE = 0,
PROPERMODE_GET = 1,
PROPERMODE_SET = 2,
PROPERMODE_FREEZE = 3,
PROPERMODE_UNFREEZE = 4,
PROPERMODE_INIT_ALGORITHM = 5,
PROPERMODE_RELEASE_ALGORITHM = 6,
};
// 执行器属性列表
// Actuator property list
enum SetPropertyType: uint32_t {
INIT_ALGORITHM = 1,
FREEZE_TEMPLATE = 2,
THAW_TEMPLATE = 3,
INIT_ALGORITHM = 1,
FREEZE_TEMPLATE = 2,
THAW_TEMPLATE = 3,
};
struct SetPropertyRequest {
AuthType authType;
SetPropertyType key;
std::vector<uint8_t> setInfo;
};
// 认证结果
// Authentication Result
struct AuthResult {
std::vector<uint8_t> token;
uint32_t remainTimes;
@@ -121,7 +123,7 @@ struct FreezInfo {
AuthType authType;
};
// 结果码
// Result Code
enum ResultCode: int32_t {
/**
* Indicates that authentication is success or ability is supported.
+5 -1
View File
@@ -45,20 +45,24 @@ public:
void CoauthSetPropAuthInfo(int32_t resultCode, uint64_t callerUID, std::string pkgName, UserAuthToken authToken,
SetPropertyRequest requset, sptr<IUserAuthCallback>& callback);
/* Set the executor authentication properties */
/* Set the executor authentication properties for freez or unfreez */
void SetPropAuthInfo(uint64_t callerUID, std::string pkgName, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest requset, std::vector<uint64_t> templateIds,
sptr<IUserAuthCallback>& callback);
/* get the executor authentication properties for Coauth */
void GetPropAuthInfoCoauth(uint64_t callerUID, std::string pkgName, int32_t resultCode, UserAuthToken authToken,
GetPropertyRequest requset, sptr<IUserAuthCallback>& callback);
/* get userID */
int32_t GetUserID(int32_t &userID);
int32_t GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds);
int32_t RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken,
UserAuthToken &authToken, std::vector<uint64_t> &sessionIds);
int32_t CancelContext(uint64_t contextId, std::vector<uint64_t> &sessionIds);
int32_t Cancel(uint64_t sessionId);
/* get the executor authentication properties */
int32_t GetExecutorProp(uint64_t callerUID, std::string pkgName, uint64_t templateId, GetPropertyRequest requset,
ExecutorProperty &result);
/* Set the executor authentication properties */
int32_t SetExecutorProp(uint64_t callerUID, std::string pkgName, SetPropertyRequest requset,
sptr<IUserAuthCallback>& callback);
int32_t GetVersion();
+6 -3
View File
@@ -94,7 +94,7 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
setPropCallback->OnResult(ret, extraInfo);
return ret;
}
value = requset.key ==SetPropertyType::FREEZE_TEMPLATE ?
value = requset.key == SetPropertyType::FREEZE_TEMPLATE ?
static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_FREEZE)
: static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_UNFREEZE);
ret = authAttributes.SetUint32Value(AUTH_PROPERTY_MODE, value);
@@ -331,7 +331,10 @@ int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUID, std::string pkgName
std::shared_ptr<CoAuth::SetPropCallback> setPropCallback = std::make_shared<UserAuthCallbackImplSetProp>(callback);
OHOS::UserIAM::AuthResPool::AuthAttributes pAuthAttributes;
int32_t ret = pAuthAttributes.SetUint32Value(AUTH_PROPERTY_MODE, PROPERMODE_SET);
uint32_t value = requset.key == SetPropertyType::INIT_ALGORITHM ?
static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_INIT_ALGORITHM)
: static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_RELEASE_ALGORITHM);
int32_t ret = pAuthAttributes.SetUint32Value(AUTH_PROPERTY_MODE, value);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint32Value SET_AUTH_PROPERTY_MODE ERROR!");
return ret;
@@ -355,7 +358,7 @@ int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUID, std::string pkgName
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint32Value AUTH_TYPE ERROR!");
return ret;
}
ret = pAuthAttributes.SetUint8ArrayValue(AUTH_SIGNATURE, requset.setInfo);
ret = pAuthAttributes.SetUint8ArrayValue(ALGORITHM_INFO, requset.setInfo);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint8ArrayValue init ERROR!");
return ret;