mirror of
https://gitee.com/openharmony/useriam_user_auth_framework
synced 2024-11-23 07:39:51 +00:00
commit
de76c7f3f6
2
OAT.xml
2
OAT.xml
@ -1,5 +1,5 @@
|
||||
<?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");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -12,6 +12,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <new>
|
||||
|
||||
#include <if_system_ability_manager.h>
|
||||
@ -54,7 +55,7 @@ sptr<IUserAuth> UserAuth::GetProxy()
|
||||
|
||||
proxy_ = iface_cast<IUserAuth>(obj);
|
||||
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_;
|
||||
}
|
||||
|
||||
@ -82,7 +83,7 @@ void UserAuth::UserAuthDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &r
|
||||
}
|
||||
|
||||
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)
|
||||
@ -118,6 +119,7 @@ void UserAuth::GetProperty(const GetPropertyRequest &request, std::shared_ptr<Ge
|
||||
}
|
||||
proxy_->GetProperty(request, asyncStub);
|
||||
}
|
||||
|
||||
void UserAuth::SetProperty(const SetPropertyRequest &request, std::shared_ptr<SetPropCallback> callback)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t UserAuth::CancelAuth(const uint64_t contextId)
|
||||
{
|
||||
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);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int32_t UserAuth::GetVersion()
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_INNERKIT, "userauth GetVersion is start");
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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);
|
||||
|
||||
/**
|
||||
* @brief Get the Availabe Status object
|
||||
* @brief Get the available Status object
|
||||
*
|
||||
* @param env
|
||||
* @param info
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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.key_ = convert_.GetInt32ValueByKey(env, object, "key");
|
||||
request.setInfo_ = convert_.NapiGetValueUint8Array(env, object, "setInfo");
|
||||
USERAUTH_HILOGI(MODULE_JS_NAPI, "AuthBuild::SetPropertyRequestBuild authType = %{public}d, key = %{public}d",
|
||||
request.authType_, request.key_);
|
||||
USERAUTH_HILOGI(MODULE_JS_NAPI, "AuthBuild::SetPropertyRequestBuild authType = %{public}d",
|
||||
request.authType_);
|
||||
return request;
|
||||
}
|
||||
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -120,7 +120,7 @@ void AuthApiCallback::OnAuthAcquireInfo(AcquireInfoInner *acquireInfoInner)
|
||||
napi_value callback;
|
||||
napi_status napiStatus = napi_get_reference_value(env, acquireInfoInner->onAcquireInfo, &callback);
|
||||
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 work;
|
||||
return;
|
||||
@ -131,7 +131,7 @@ void AuthApiCallback::OnAuthAcquireInfo(AcquireInfoInner *acquireInfoInner)
|
||||
napi_create_int32(env, acquireInfoInner->extraInfo, ¶ms[PARAM2]);
|
||||
napiStatus = napi_call_function(env, nullptr, callback, PARAM3, params, &returnOnAcquire);
|
||||
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 work;
|
||||
@ -187,7 +187,7 @@ static void OnUserAuthResultWork(uv_work_t *work, int status)
|
||||
napi_value callback;
|
||||
napi_status napiStatus = napi_get_reference_value(env, userInfo->onResult, &callback);
|
||||
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 work;
|
||||
return;
|
||||
@ -242,7 +242,7 @@ static void OnAuthResultWork(uv_work_t *work, int status)
|
||||
napi_value callback;
|
||||
napi_status napiStatus = napi_get_reference_value(env, authInfo->onResult, &callback);
|
||||
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 work;
|
||||
return;
|
||||
@ -296,7 +296,7 @@ static void OnExecuteResultWork(uv_work_t *work, int status)
|
||||
napi_env env = executeInfo->env;
|
||||
napi_value result;
|
||||
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 executeInfo;
|
||||
return;
|
||||
@ -389,19 +389,19 @@ static void GetPropertyInfoCallback(uv_work_t* work, int status)
|
||||
napi_value global = nullptr;
|
||||
napi_status napiStatus = napi_get_global(env, &global);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global failed");
|
||||
goto EXIT;
|
||||
}
|
||||
napi_value resultValue = nullptr;
|
||||
napi_value callBack = nullptr;
|
||||
napiStatus = napi_get_reference_value(env, getPropertyInfo->callBackInfo.callBack, &callBack);
|
||||
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;
|
||||
}
|
||||
napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &resultValue);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
|
||||
goto EXIT;
|
||||
}
|
||||
} else {
|
||||
@ -410,7 +410,7 @@ static void GetPropertyInfoCallback(uv_work_t* work, int status)
|
||||
napi_deferred deferred = getPropertyInfo->callBackInfo.deferred;
|
||||
napi_status napiStatus = napi_resolve_deferred(env, deferred, resultValue);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_resolve_deferred faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_resolve_deferred failed");
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
@ -495,14 +495,14 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
|
||||
napi_env env = setPropertyInfo->callBackInfo.env;
|
||||
napi_status napiStatus = napi_create_int32(env, setPropertyInfo->setResult, &setPropertyInfo->result);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_create_int32 failed");
|
||||
goto EXIT;
|
||||
}
|
||||
if (setPropertyInfo->callBackInfo.callBack != nullptr) {
|
||||
napi_value global = nullptr;
|
||||
napiStatus = napi_get_global(env, &global);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_get_global failed");
|
||||
goto EXIT;
|
||||
}
|
||||
napi_value resultData[PARAM1];
|
||||
@ -512,12 +512,12 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
|
||||
napi_value callBack = nullptr;
|
||||
napiStatus = napi_get_reference_value(env, setPropertyInfo->callBackInfo.callBack, &callBack);
|
||||
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;
|
||||
}
|
||||
napiStatus = napi_call_function(env, global, callBack, PARAM1, resultData, &result);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
|
||||
goto EXIT;
|
||||
}
|
||||
} else {
|
||||
@ -525,7 +525,7 @@ static void SetExecutorPropertyCallback(uv_work_t *work, int status)
|
||||
napi_deferred deferred = setPropertyInfo->callBackInfo.deferred;
|
||||
napiStatus = napi_resolve_deferred(env, deferred, result);
|
||||
if (napiStatus != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_call_function failed");
|
||||
goto EXIT;
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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;
|
||||
status = napi_typeof(env, value, &type);
|
||||
if (status != napi_ok) {
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_typeof faild");
|
||||
USERAUTH_HILOGE(MODULE_JS_NAPI, "napi_typeof failed");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@ -138,13 +138,13 @@ std::vector<uint32_t> ResultConvert::GetInt32ArrayValueByKey(napi_env env, napi_
|
||||
bool isArray = false;
|
||||
status = napi_is_array(env, array, &isArray);
|
||||
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>();
|
||||
}
|
||||
if (isArray) {
|
||||
USERAUTH_HILOGI(MODULE_JS_NAPI, "args[PIN_PARAMS_ONE] is a array");
|
||||
} 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 GetCppArrayUint32(env, array);
|
||||
@ -163,7 +163,7 @@ std::string ResultConvert::NapiGetValueString(napi_env env, napi_value value)
|
||||
size_t resultSize = 0;
|
||||
status = napi_get_value_string_utf8(env, value, valueString, valueSize, &resultSize);
|
||||
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;
|
||||
if (resultValue == "") {
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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 info
|
||||
@ -459,11 +459,11 @@ napi_value UserAuthInit(napi_env env, napi_value exports)
|
||||
status = napi_define_properties(env, exports,
|
||||
sizeof(exportFuncs) / sizeof(napi_property_descriptor), exportFuncs);
|
||||
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));
|
||||
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;
|
||||
}
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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.keys = getPropertyInfo->keys;
|
||||
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;
|
||||
callback.reset(object);
|
||||
UserAuth::GetInstance().GetProperty(request, callback);
|
||||
@ -299,7 +303,11 @@ void UserAuthImpl::SetPropertyExecute(napi_env env, void *data)
|
||||
request.authType = authTypeGet;
|
||||
request.key = SetPropertyType(setPropertyInfo->key);
|
||||
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;
|
||||
callback.reset(object);
|
||||
UserAuth::GetInstance().SetProperty(request, callback);
|
||||
@ -472,7 +480,10 @@ bool UserAuthImpl::GetExecuteInfo(napi_env env, napi_value* argv, ExecuteInfo* e
|
||||
size_t len = 0;
|
||||
napi_get_value_string_utf8(env, argv[PARAM0], nullptr, 0, &len);
|
||||
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);
|
||||
executeInfo->type = 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);
|
||||
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);
|
||||
executeInfo->level = 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__);
|
||||
AuthInfo *authInfo = new (std::nothrow) AuthInfo();
|
||||
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;
|
||||
}
|
||||
authInfo->info = info;
|
||||
napi_value ret = BuildAuthInfo(env, authInfo);
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
callback.reset(object);
|
||||
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__);
|
||||
AuthUserInfo *userInfo = new (std::nothrow) AuthUserInfo();
|
||||
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;
|
||||
}
|
||||
userInfo->callBackInfo.env = env;
|
||||
userInfo->info = info;
|
||||
napi_value ret = BuildAuthUserInfo(env, userInfo);
|
||||
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;
|
||||
return ret;
|
||||
}
|
||||
@ -586,7 +604,11 @@ napi_value UserAuthImpl::BuildAuthUserInfo(napi_env env, AuthUserInfo *userInfo)
|
||||
napi_value UserAuthImpl::AuthUserWrap(napi_env env, AuthUserInfo *userInfo)
|
||||
{
|
||||
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;
|
||||
callback.reset(object);
|
||||
uint64_t result = UserAuth::GetInstance().AuthUser(userInfo->userId, userInfo->challenge,
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -26,6 +26,7 @@ enum AuthType : uint32_t {
|
||||
PIN = 1,
|
||||
FACE = 2,
|
||||
};
|
||||
|
||||
// Authentication subtype (2D face, 3D face...)
|
||||
enum AuthSubType : uint64_t {
|
||||
/**
|
||||
@ -49,6 +50,7 @@ enum AuthSubType : uint64_t {
|
||||
*/
|
||||
FACE_3D = 20001
|
||||
};
|
||||
|
||||
// Certification result confidence level
|
||||
enum AuthTurstLevel : uint32_t {
|
||||
// level 1-4
|
||||
@ -57,6 +59,7 @@ 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)
|
||||
@ -66,12 +69,14 @@ enum GetPropertyType : uint32_t {
|
||||
// Freeze time
|
||||
FREEZING_TIME = 3,
|
||||
};
|
||||
|
||||
// get attribute request
|
||||
struct GetPropertyRequest {
|
||||
AuthType authType {0};
|
||||
// GetPropertyType
|
||||
std::vector<uint32_t> keys {};
|
||||
};
|
||||
|
||||
// Actuator properties
|
||||
struct ExecutorProperty {
|
||||
int32_t result;
|
||||
@ -79,6 +84,7 @@ struct ExecutorProperty {
|
||||
uint32_t remainTimes;
|
||||
uint32_t freezingTime;
|
||||
};
|
||||
|
||||
// Actuator property mode list
|
||||
enum AuthPropertyMode : uint32_t {
|
||||
PROPERMODE_DELETE = 0,
|
||||
@ -89,23 +95,27 @@ enum AuthPropertyMode : uint32_t {
|
||||
PROPERMODE_INIT_ALGORITHM = 5,
|
||||
PROPERMODE_RELEASE_ALGORITHM = 6,
|
||||
};
|
||||
|
||||
// Actuator property list
|
||||
enum SetPropertyType : uint32_t {
|
||||
INIT_ALGORITHM = 1,
|
||||
FREEZE_TEMPLATE = 2,
|
||||
THAW_TEMPLATE = 3,
|
||||
};
|
||||
|
||||
struct SetPropertyRequest {
|
||||
AuthType authType {0};
|
||||
SetPropertyType key {0};
|
||||
std::vector<uint8_t> setInfo {};
|
||||
};
|
||||
|
||||
// Authentication Result
|
||||
struct AuthResult {
|
||||
std::vector<uint8_t> token {};
|
||||
uint32_t remainTimes {0};
|
||||
uint32_t freezingTime {0};
|
||||
};
|
||||
|
||||
struct CoAuthInfo {
|
||||
AuthType authType {0};
|
||||
uint64_t callerID {0};
|
||||
@ -122,6 +132,12 @@ struct FreezInfo {
|
||||
AuthType authType;
|
||||
};
|
||||
|
||||
struct UserInfo {
|
||||
uint64_t callerUID;
|
||||
int32_t userID {0};
|
||||
std::string pkgName;
|
||||
};
|
||||
|
||||
// Result Code
|
||||
enum ResultCode : int32_t {
|
||||
/**
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?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");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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
|
||||
* 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);
|
||||
|
||||
/* 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);
|
||||
/* 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);
|
||||
int32_t GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds);
|
||||
int32_t RequestAuthResult(uint64_t contextId, std::vector<uint8_t> scheduleToken, UserAuthToken &authToken,
|
||||
@ -70,8 +70,8 @@ private:
|
||||
~UserAuthAdapter() = default;
|
||||
int32_t GetEachExecutorProp(GetPropertyRequest &requset, ExecutorProperty &result, uint32_t &value,
|
||||
std::shared_ptr<OHOS::UserIAM::AuthResPool::AuthAttributes> pAuthAttributes);
|
||||
int32_t SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, uint64_t callerUID,
|
||||
std::string pkgName, SetPropertyRequest requset, std::vector<uint64_t> templateIds,
|
||||
int32_t SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, UserInfo userInfo,
|
||||
SetPropertyRequest requset, std::vector<uint64_t> templateIds,
|
||||
std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback);
|
||||
};
|
||||
} // namespace UserAuth
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -90,14 +90,14 @@ private:
|
||||
class UserAuthCallbackImplIDMGetPorp : public UserIDM::GetInfoCallback {
|
||||
public:
|
||||
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;
|
||||
|
||||
void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override;
|
||||
|
||||
private:
|
||||
sptr<IUserAuthCallback> callback_ { nullptr };
|
||||
GetPropertyRequest requst_;
|
||||
GetPropertyRequest request_;
|
||||
std::string pkgName_;
|
||||
uint64_t callerUid_;
|
||||
};
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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)
|
||||
{
|
||||
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);
|
||||
if (ret != SUCCESS) {
|
||||
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,
|
||||
GetPropertyRequest requset, sptr<IUserAuthCallback> &callback)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfo is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfo is start!");
|
||||
using namespace UserIDM;
|
||||
std::shared_ptr<GetInfoCallback> getInfoCallback =
|
||||
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) {
|
||||
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)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetPropAuthInfo is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth SetPropAuthInfo is start!");
|
||||
using namespace AuthResPool;
|
||||
FreezInfo freezInfo;
|
||||
freezInfo.callerID = callerUID;
|
||||
freezInfo.callerID = userInfo.callerUID;
|
||||
freezInfo.authType = requset.authType;
|
||||
freezInfo.pkgName = pkgName;
|
||||
freezInfo.pkgName = userInfo.pkgName;
|
||||
freezInfo.resultCode = resultCode;
|
||||
|
||||
std::shared_ptr<CoAuth::SetPropCallback> setPropCallback =
|
||||
std::make_shared<UserAuthCallbackImplSetPropFreez>(templateIds, authToken, freezInfo);
|
||||
if (setPropCallback == nullptr) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetPropAuthInfo setPropCallback nullptr!");
|
||||
return;
|
||||
}
|
||||
AuthAttributes authAttributes;
|
||||
int32_t ret = SetProPropAuthInfo(authAttributes, callerUID, pkgName, requset, templateIds, setPropCallback);
|
||||
int32_t ret = SetProPropAuthInfo(authAttributes, userInfo, requset, templateIds, setPropCallback);
|
||||
if (ret != SUCCESS) {
|
||||
return;
|
||||
}
|
||||
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,
|
||||
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)
|
||||
{
|
||||
uint32_t value;
|
||||
@ -105,7 +110,7 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
|
||||
setPropCallback->OnResult(ret, extraInfo);
|
||||
return ret;
|
||||
}
|
||||
ret = authAttributes.SetUint64Value(AUTH_CALLER_UID, callerUID);
|
||||
ret = authAttributes.SetUint64Value(AUTH_CALLER_UID, userInfo.callerUID);
|
||||
if (ret != SUCCESS) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint32Value AUTH_CALLER_UID ERROR!");
|
||||
std::vector<uint8_t> extraInfo;
|
||||
@ -113,9 +118,9 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
|
||||
return ret;
|
||||
}
|
||||
std::vector<uint8_t> pkgNameValue;
|
||||
pkgName.resize(pkgName.size());
|
||||
userInfo.pkgName.resize(userInfo.pkgName.size());
|
||||
pkgNameValue.clear();
|
||||
pkgNameValue.assign(pkgName.begin(), pkgName.end());
|
||||
pkgNameValue.assign(userInfo.pkgName.begin(), userInfo.pkgName.end());
|
||||
ret = authAttributes.SetUint8ArrayValue(AUTH_CALLER_NAME, pkgNameValue);
|
||||
if (ret != SUCCESS) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth SetUint8ArrayValue->AUTH_CALLER_NAME ERROR!");
|
||||
@ -132,39 +137,39 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
|
||||
}
|
||||
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)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetPropAuthInfoCoauth is start!");
|
||||
using namespace UserIDM;
|
||||
std::shared_ptr<GetInfoCallback> getInfoCallback = std::make_shared<UserAuthCallbackImplIDMGetPorpCoauth>(callback,
|
||||
callerUID, pkgName, resultCode, authToken, requset);
|
||||
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userID, static_cast<UserIDM::AuthType>(requset.authType),
|
||||
getInfoCallback);
|
||||
userInfo.callerUID, userInfo.pkgName, resultCode, authToken, requset);
|
||||
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userInfo.userID,
|
||||
static_cast<UserIDM::AuthType>(requset.authType), getInfoCallback);
|
||||
if (ret != SUCCESS) {
|
||||
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)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth CoauthSetPropAuthInfo is start!");
|
||||
using namespace UserIDM;
|
||||
std::shared_ptr<GetInfoCallback> setPropCallback = std::make_shared<UserAuthCallbackImplIDMCothGetPorpFreez>(
|
||||
callerUID, pkgName, resultCode, authToken, requset);
|
||||
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userID, static_cast<UserIDM::AuthType>(requset.authType),
|
||||
setPropCallback);
|
||||
userInfo.callerUID, userInfo.pkgName, resultCode, authToken, requset);
|
||||
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userInfo.userID,
|
||||
static_cast<UserIDM::AuthType>(requset.authType), setPropCallback);
|
||||
if (ret != SUCCESS) {
|
||||
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)
|
||||
{
|
||||
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);
|
||||
if (ret != SUCCESS) {
|
||||
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,
|
||||
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);
|
||||
if (ret != SUCCESS) {
|
||||
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;
|
||||
}
|
||||
|
||||
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);
|
||||
if (ret != SUCCESS) {
|
||||
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)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth Cancel is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth Cancel is start!");
|
||||
int32_t ret = CoAuth::CoAuth::GetInstance().Cancel(sessionId);
|
||||
if (ret != SUCCESS) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth Cancel ERROR!");
|
||||
@ -206,7 +211,7 @@ int32_t UserAuthAdapter::Cancel(uint64_t sessionId)
|
||||
|
||||
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;
|
||||
|
||||
return version;
|
||||
@ -215,7 +220,7 @@ int32_t UserAuthAdapter::GetVersion()
|
||||
int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUID, std::string pkgName, uint64_t templateId,
|
||||
GetPropertyRequest requset, ExecutorProperty &result)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth GetExecutorProp is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth GetExecutorProp is start!");
|
||||
using namespace AuthResPool;
|
||||
uint32_t value;
|
||||
|
||||
@ -308,7 +313,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut
|
||||
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);
|
||||
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,
|
||||
sptr<IUserAuthCallback> &callback)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth SetExecutorProp is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth SetExecutorProp is start!");
|
||||
using namespace AuthResPool;
|
||||
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)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuth coAuth is start!");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuth coAuth is start!");
|
||||
|
||||
std::shared_ptr<CoAuth::CoAuthCallback> coAuthCallback =
|
||||
std::make_shared<UserAuthCallbackImplCoAuth>(callback, coAuthInfo, false);
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* 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 reply;
|
||||
if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) {
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "userauth write descriptor failed!");
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "userauth write descriptor failed!");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteInt32(result)) {
|
||||
@ -89,7 +89,7 @@ void UserAuthAsyncProxy::onExecutorPropertyInfo(const ExecutorProperty result)
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
if (!data.WriteInterfaceToken(UserAuthAsyncProxy::GetDescriptor())) {
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "userauth write descriptor failed!");
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "userauth write descriptor failed!");
|
||||
return;
|
||||
}
|
||||
if (!data.WriteInt32(result.result)) {
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -29,6 +29,7 @@ namespace UserIAM {
|
||||
namespace UserAuth {
|
||||
std::mutex UserAuthCallbackImplCoAuth::coauthCallbackmutex_;
|
||||
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> UserAuthCallbackImplCoAuth::saveCoauthCallback_;
|
||||
|
||||
UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCallback>& impl)
|
||||
{
|
||||
if (impl == nullptr) {
|
||||
@ -37,6 +38,7 @@ UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCal
|
||||
}
|
||||
callback_ = impl;
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplSetProp::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetProp OnResult enter");
|
||||
@ -59,6 +61,7 @@ UserAuthCallbackImplSetPropFreez::UserAuthCallbackImplSetPropFreez(std::vector<u
|
||||
pkgName_ = freezInfo.pkgName;
|
||||
callerUid_ = freezInfo.callerID;
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplSetPropFreez::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetPropFreez result is %{public}u", result);
|
||||
@ -80,6 +83,7 @@ UserAuthCallbackImplCoAuth::UserAuthCallbackImplCoAuth(const sptr<IUserAuthCallb
|
||||
callerUid_ = coAuthInfo.callerID;
|
||||
userID_ = coAuthInfo.userID;
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplCoAuth::OnFinish(uint32_t resultCode, std::vector<uint8_t> &scheduleToken)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnFinish enter");
|
||||
@ -95,6 +99,7 @@ void UserAuthCallbackImplCoAuth::OnFinish(uint32_t resultCode, std::vector<uint8
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplCoAuth::OnAcquireInfo(uint32_t acquire)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth OnAcquireInfo enter");
|
||||
@ -107,6 +112,7 @@ void UserAuthCallbackImplCoAuth::OnAcquireInfo(uint32_t acquire)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userID, SetPropertyRequest setPropertyRequest,
|
||||
AuthResult authResult, int32_t ret, UserAuthToken authToken)
|
||||
{
|
||||
@ -114,8 +120,11 @@ void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userID, SetPropert
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "RequestAuthResult SUCCESS");
|
||||
setPropertyRequest.authType = UserAuth::FACE;
|
||||
setPropertyRequest.key = SetPropertyType::THAW_TEMPLATE;
|
||||
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userID, ret, callerUid_, pkgName_,
|
||||
authToken, setPropertyRequest);
|
||||
UserInfo userInfo;
|
||||
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;
|
||||
GetPropertyRequest getPropertyRequest;
|
||||
AuthResult authResult;
|
||||
UserInfo userInfo;
|
||||
int32_t ret = GENERAL_ERROR;
|
||||
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",
|
||||
scheduleToken.size(), resultCode);
|
||||
callbackNowCount_++;
|
||||
@ -165,7 +178,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplCoAuth resultCode == LOCKED");
|
||||
setPropertyRequest.authType = FACE;
|
||||
setPropertyRequest.key = SetPropertyType::FREEZE_TEMPLATE;
|
||||
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userID_, resultCode, callerUid_, pkgName_, authToken,
|
||||
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(userInfo, resultCode, authToken,
|
||||
setPropertyRequest);
|
||||
}
|
||||
if (ret == SUCCESS) {
|
||||
@ -174,7 +187,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
|
||||
getPropertyRequest.authType = authType_;
|
||||
getPropertyRequest.keys.push_back(UserAuth::REMAIN_TIMES);
|
||||
getPropertyRequest.keys.push_back(UserAuth::FREEZING_TIME);
|
||||
UserAuthAdapter::GetInstance().GetPropAuthInfoCoauth(userID_, callerUid_, pkgName_, resultCode,
|
||||
UserAuthAdapter::GetInstance().GetPropAuthInfoCoauth(userInfo, resultCode,
|
||||
authToken, getPropertyRequest, callback_);
|
||||
DealFinishData(sessionIds);
|
||||
}
|
||||
@ -225,7 +238,7 @@ int32_t UserAuthCallbackImplCoAuth::DeleteCoauthCallback(uint64_t contextId)
|
||||
}
|
||||
|
||||
UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl,
|
||||
GetPropertyRequest requst, uint64_t callerUID,
|
||||
GetPropertyRequest request, uint64_t callerUID,
|
||||
std::string pkgName)
|
||||
{
|
||||
if (impl == nullptr) {
|
||||
@ -233,12 +246,13 @@ UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserA
|
||||
return;
|
||||
}
|
||||
callback_ = impl;
|
||||
requst_.authType = requst.authType;
|
||||
requst_.keys.clear();
|
||||
requst_.keys.assign(requst.keys.begin(), requst.keys.end());
|
||||
request_.authType = request.authType;
|
||||
request_.keys.clear();
|
||||
request_.keys.assign(request.keys.begin(), request.keys.end());
|
||||
pkgName_ = pkgName;
|
||||
callerUid_ = callerUID;
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorp OnGetInfo enter");
|
||||
@ -249,7 +263,7 @@ void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialIn
|
||||
return;
|
||||
}
|
||||
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) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuth UserAuthCallbackImplIDMGetPorp ERROR!");
|
||||
}
|
||||
@ -266,8 +280,14 @@ UserAuthCallbackImplIDMCothGetPorpFreez::UserAuthCallbackImplIDMCothGetPorpFreez
|
||||
pkgName_ = pkgName;
|
||||
callerUid_ = callerUid;
|
||||
}
|
||||
|
||||
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");
|
||||
std::vector<uint64_t> templateIds;
|
||||
AuthResult authResult;
|
||||
@ -283,7 +303,7 @@ void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::Cre
|
||||
for (auto const &item : info) {
|
||||
templateIds.push_back(item.templateId);
|
||||
}
|
||||
UserAuthAdapter::GetInstance().SetPropAuthInfo(callerUid_, pkgName_, resultCode_, authToken_, requset_,
|
||||
UserAuthAdapter::GetInstance().SetPropAuthInfo(userInfo, resultCode_, authToken_, requset_,
|
||||
templateIds);
|
||||
}
|
||||
|
||||
@ -302,6 +322,7 @@ UserAuthCallbackImplIDMGetPorpCoauth::UserAuthCallbackImplIDMGetPorpCoauth(
|
||||
pkgName_ = pkgName;
|
||||
callerUid_ = callerUid;
|
||||
}
|
||||
|
||||
void UserAuthCallbackImplIDMGetPorpCoauth::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth OnGetInfo enter");
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -40,7 +40,7 @@ UserAuthService::~UserAuthService() = default;
|
||||
|
||||
void UserAuthService::OnStart()
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "Start service");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "Start service");
|
||||
if (!Publish(this)) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "Failed to publish service");
|
||||
}
|
||||
@ -54,7 +54,7 @@ void UserAuthService::OnStart()
|
||||
|
||||
void UserAuthService::OnStop()
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "Stop service");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "Stop service");
|
||||
ContextThreadPool::GetInstance().Stop();
|
||||
bool ret = OHOS::UserIAM::Common::IsIAMInited();
|
||||
if (ret) {
|
||||
@ -77,7 +77,7 @@ bool UserAuthService::CheckPermission(const std::string &permission)
|
||||
|
||||
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) &&
|
||||
(authType == PIN || !CheckPermission(ACCESS_BIOMETRIC_PERMISSION))) {
|
||||
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);
|
||||
if (ret == SUCCESS) {
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService iAuthTurstLevel_:%{public}u", authTurstLevelFromSys);
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService authTurstLevel:%{public}u", authTurstLevel);
|
||||
USERAUTH_HILOGD(MODULE_SERVICE,
|
||||
"UserAuthService iAuthTurstLevel_:%{public}u, authTurstLevel:%{public}u",
|
||||
authTurstLevelFromSys, authTurstLevel);
|
||||
if (authTurstLevelFromSys < authTurstLevel) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthService authTurstLevel is ERROR!");
|
||||
return result;
|
||||
@ -113,7 +114,7 @@ int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthT
|
||||
|
||||
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;
|
||||
std::string callerName;
|
||||
if (callback == nullptr) {
|
||||
@ -148,7 +149,7 @@ void UserAuthService::GetProperty(const GetPropertyRequest request, sptr<IUserAu
|
||||
|
||||
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;
|
||||
uint64_t callerID = 0;
|
||||
std::string callerName;
|
||||
@ -196,14 +197,14 @@ int32_t UserAuthService::GetCallingUserID(int32_t &userID)
|
||||
return TYPE_NOT_SUPPORT;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
|
||||
sptr<IUserAuthCallback> &callback)
|
||||
{
|
||||
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthService Auth is start");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService Auth is start");
|
||||
const uint64_t invalidContextID = 0;
|
||||
int32_t userID = 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,
|
||||
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;
|
||||
uint64_t callerID = 0;
|
||||
std::string callerName;
|
||||
@ -342,7 +343,7 @@ int32_t UserAuthService::GetControllerData(sptr<IUserAuthCallback> &callback, Au
|
||||
|
||||
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;
|
||||
std::vector<uint64_t> sessionIds;
|
||||
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()
|
||||
{
|
||||
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)) {
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed");
|
||||
return E_CHECK_PERMISSION_FAILED;
|
||||
@ -395,7 +396,7 @@ void UserAuthService::UserAuthServiceCallbackDeathRecipient::OnRemoteDied(const
|
||||
}
|
||||
callback_ = nullptr;
|
||||
|
||||
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthServiceCallbackDeathRecipient::Recv death notice.");
|
||||
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthServiceCallbackDeathRecipient::Recv death notice.");
|
||||
}
|
||||
} // namespace UserAuth
|
||||
} // namespace UserIAM
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
@ -23,7 +23,7 @@ namespace UserIAM {
|
||||
namespace UserAuth {
|
||||
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());
|
||||
std::u16string descripter = UserAuthStub::GetDescriptor();
|
||||
std::u16string remoteDescripter = data.ReadInterfaceToken();
|
||||
@ -33,19 +33,19 @@ int32_t UserAuthStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messag
|
||||
}
|
||||
|
||||
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);
|
||||
case static_cast<int32_t>(IUserAuth::USER_AUTH_GET_PROPERTY):
|
||||
case static_cast<uint32_t>(IUserAuth::USER_AUTH_GET_PROPERTY):
|
||||
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);
|
||||
case static_cast<int32_t>(IUserAuth::USER_AUTH_AUTH):
|
||||
case static_cast<uint32_t>(IUserAuth::USER_AUTH_AUTH):
|
||||
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);
|
||||
case static_cast<int32_t>(IUserAuth::USER_AUTH_CANCEL_AUTH):
|
||||
case static_cast<uint32_t>(IUserAuth::USER_AUTH_CANCEL_AUTH):
|
||||
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);
|
||||
default:
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
|
@ -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");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
|
Loading…
Reference in New Issue
Block a user