Change-Id: I4955c48ace8a69710dabf689168bcbb23786b05d
This commit is contained in:
liuziwei 2024-04-25 15:08:51 +08:00
commit e1fd784265
10 changed files with 17 additions and 41 deletions

View File

@ -46,9 +46,7 @@
"hitrace",
"c_utils",
"common_event_service",
"window_manager"
],
"third_party": [
"window_manager",
"openssl"
]
},

View File

@ -11,11 +11,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
import("//build/ohos.gni")
import("//commonlibrary/memory_utils/purgeable_mem_config.gni")
import("//foundation/ability/ability_runtime/ability_runtime.gni")
import("//foundation/distributeddatamgr/relational_store/relational_store.gni")
ohos_shared_library("user_auth_extension") {
sanitize = {

View File

@ -13,7 +13,6 @@
import("//arkcompiler/ets_frontend/es2panda/es2abc_config.gni")
import("//build/ohos.gni")
import("//foundation/arkui/ace_engine/ace_config.gni")
es2abc_gen_abc("gen_user_auth_icon_abc") {
src_js = rebase_path("user_auth_icon.js")

View File

@ -43,12 +43,15 @@ ResultCode CollectCommand::SendRequest()
auto hdi = GetExecutorHdi();
IF_FALSE_LOGE_AND_RETURN_VAL(hdi != nullptr, ResultCode::GENERAL_ERROR);
uint32_t tokenId = 0;
bool getTokenIdRet = attributes_->GetUint32Value(Attributes::ATTR_ACCESS_TOKEN_ID, tokenId);
IF_FALSE_LOGE_AND_RETURN_VAL(getTokenIdRet == true, ResultCode::GENERAL_ERROR);
std::vector<uint8_t> extraInfo;
bool getExtraInfoRet = attributes_->GetUint8ArrayValue(Attributes::ATTR_EXTRA_INFO, extraInfo);
IF_FALSE_LOGE_AND_RETURN_VAL(getExtraInfoRet == true, ResultCode::GENERAL_ERROR);
IamHitraceHelper traceHelper("hdi collect");
ResultCode ret = hdi->Collect(scheduleId_, (CollectParam) { extraInfo }, shared_from_this());
ResultCode ret = hdi->Collect(scheduleId_, (CollectParam) { tokenId, extraInfo }, shared_from_this());
IAM_LOGI("%{public}s collect result %{public}d", GetDescription(), ret);
return ret;
}

View File

@ -69,6 +69,8 @@ struct AuthenticateParam {
* @brief Defines Collect parameter.
*/
struct CollectParam {
/** Token id. */
uint32_t tokenId;
/** Extra info. */
std::vector<uint8_t> extraInfo;
};

View File

@ -58,7 +58,6 @@ ohos_source_set("userauth_service_context") {
"../../frameworks/native/common:attributes",
"../../frameworks/native/common:dfx",
"../../services/core:userauth_service_core",
"//third_party/openssl:libcrypto_shared",
]
external_deps = [
@ -74,6 +73,7 @@ ohos_source_set("userauth_service_context") {
"hitrace:hitrace_meter",
"init:libbegetutil",
"napi:ace_napi",
"openssl:libcrypto_shared",
]
public_configs = [ ":userauth_service_context_config" ]

View File

@ -907,7 +907,7 @@ int32_t UserAuthService::UnRegistUserAuthSuccessEventListener(
int32_t UserAuthService::SetGlobalConfigParam(const GlobalConfigParam &param)
{
IAM_LOGE("start");
IAM_LOGI("start");
if (!IpcCommon::CheckPermission(*this, ACCESS_USER_AUTH_INTERNAL_PERMISSION)) {
IAM_LOGE("failed to check permission");
return CHECK_PERMISSION_FAILED;

View File

@ -241,7 +241,6 @@ ohos_source_set("userauth_service_context_fuzzer") {
"../common_fuzzer:attributes_fuzzer",
"../common_fuzzer:dfx_fuzzer",
"../common_fuzzer:userauth_service_core_fuzzer",
"//third_party/openssl:libcrypto_shared",
]
external_deps = [
@ -256,6 +255,7 @@ ohos_source_set("userauth_service_context_fuzzer") {
"hitrace:hitrace_meter",
"init:libbegetutil",
"napi:ace_napi",
"openssl:libcrypto_shared",
]
public_configs =

View File

@ -1741,7 +1741,7 @@ HWTEST_F(UserAuthServiceTest, UserAuthServiceSetGlobalConfigParam, TestSize.Leve
EXPECT_EQ(service.SetGlobalConfigParam(param), ResultCode::INVALID_PARAMETERS);
param.type = PIN_EXPIRED_PERIOD;
EXPECT_EQ(service.SetGlobalConfigParam(param), ResultCode::GENERAL_ERROR);
EXPECT_EQ(service.SetGlobalConfigParam(param), ResultCode::SUCCESS);
auto mockHdi = MockIUserAuthInterface::Holder::GetInstance().Get();

View File

@ -62,8 +62,8 @@ HWTEST_F(UserAuthStubTest, UserAuthStubGetEnrolledStateStub002, TestSize.Level0)
MockUserAuthService service;
int32_t testApiVersion = 12;
AuthType testAuthType = FACE;
uint16_t expectCredentialDigest = 23962;
uint64_t expectCredentialCount = 1;
uint64_t expectCredentialDigest = 23962;
uint16_t expectCredentialCount = 1;
EXPECT_CALL(service, GetEnrolledState(_, _, _)).Times(1);
ON_CALL(service, GetEnrolledState)
.WillByDefault(
@ -88,11 +88,11 @@ HWTEST_F(UserAuthStubTest, UserAuthStubGetEnrolledStateStub002, TestSize.Level0)
int32_t result = FAIL;
EXPECT_TRUE(reply.ReadInt32(result));
EXPECT_EQ(SUCCESS, result);
uint16_t actualCredentialDigest;
EXPECT_TRUE(reply.ReadUint16(actualCredentialDigest));
uint64_t actualCredentialDigest;
EXPECT_TRUE(reply.ReadUint64(actualCredentialDigest));
EXPECT_EQ(expectCredentialDigest, actualCredentialDigest);
uint64_t actualCredentialCount;
EXPECT_TRUE(reply.ReadUint64(actualCredentialCount));
uint16_t actualCredentialCount;
EXPECT_TRUE(reply.ReadUint16(actualCredentialCount));
EXPECT_EQ(expectCredentialCount, actualCredentialCount);
}
@ -565,29 +565,6 @@ HWTEST_F(UserAuthStubTest, UserAuthStubUnRegistUserAuthSuccessEventListenerStub,
EXPECT_TRUE(reply.ReadInt32(result));
EXPECT_EQ(result, SUCCESS);
}
HWTEST_F(UserAuthStubTest, UserAuthStubSetGlobalConfigParamStub, TestSize.Level0)
{
MockUserAuthService service;
EXPECT_CALL(service, SetGlobalConfigParam(_)).Times(1);
ON_CALL(service, SetGlobalConfigParam)
.WillByDefault(
[](const GlobalConfigParam &param) {
return SUCCESS;
}
);
MessageParcel data;
MessageParcel reply;
MessageOption option(MessageOption::TF_SYNC);
uint32_t code = UserAuthInterfaceCode::USER_AUTH_SET_CLOBAL_CONFIG_PARAM;
EXPECT_TRUE(data.WriteInterfaceToken(UserAuthInterface::GetDescriptor()));
EXPECT_EQ(SUCCESS, service.OnRemoteRequest(code, data, reply, option));
int32_t result;
EXPECT_TRUE(reply.ReadInt32(result));
EXPECT_EQ(result, SUCCESS);
}
} // namespace UserAuth
} // namespace UserIam
} // namespace OHOS