fix: word spell fix.

Signed-off-by: Zen知仁 <xuzhiren@huawei.com>
Change-Id: I0ef4181fa133882a14ea3fa1601a168bb141edd1
Signed-off-by: Zen知仁 <xuzhiren@huawei.com>
This commit is contained in:
Zen知仁 2022-03-24 12:30:39 +08:00
parent c7c5d977c6
commit 8dbdc61621
22 changed files with 263 additions and 232 deletions

40
.gitignore vendored Normal file
View File

@ -0,0 +1,40 @@
#vscode
.vscode
#format
.clang-format
# Prerequisites
*.d
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app

View File

@ -38,8 +38,8 @@ The userauth APIs support user authentication of the target Authentication Trust
| API | Description |
| ------ | -------------------------------- |
| getAvailableStatus(authType : AuthType, authTrustLevel : AuthTurstLevel) : number; | Obtains the available authentication status.|
| auth(challenge: BigInt, authType : AuthType, authTrustLevel: AuthTurstLevel, callback: IUserAuthCallback): BigInt; | Performs user authentication. |
| getAvailableStatus(authType : AuthType, authTrustLevel : AuthTrustLevel) : number; | Obtains the available authentication status.|
| auth(challenge: BigInt, authType : AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): BigInt; | Performs user authentication. |
### Usage Guidelines

View File

@ -44,8 +44,8 @@
| 接口名 | 描述 |
| ------ | -------------------------------- |
| getAvailableStatus(authType : AuthType, authTrustLevel : AuthTurstLevel) : number; | 指定ATL查询是否支持目标认证方式 |
| auth(challenge: BigInt, authType : AuthType, authTrustLevel: AuthTurstLevel, callback: IUserAuthCallback): BigInt; | 指定ATL和认证方式完成用户身份认证 |
| getAvailableStatus(authType : AuthType, authTrustLevel : AuthTrustLevel) : number; | 指定ATL查询是否支持目标认证方式 |
| auth(challenge: BigInt, authType : AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): BigInt; | 指定ATL和认证方式完成用户身份认证 |
### 使用说明

View File

@ -81,7 +81,7 @@ void UserAuth::UserAuthDeathRecipient::OnRemoteDied(const wptr<IRemoteObject> &r
UserAuth::GetInstance().ResetProxy(remote);
}
int32_t UserAuth::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel)
int32_t UserAuth::GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "GetAvailableStatus start");
auto proxy = GetProxy();
@ -89,7 +89,7 @@ int32_t UserAuth::GetAvailableStatus(const AuthType authType, const AuthTurstLev
return E_RET_NOSERVER;
}
return proxy_->GetAvailableStatus(authType, authTurstLevel);
return proxy_->GetAvailableStatus(authType, authTrustLevel);
}
void UserAuth::GetProperty(const GetPropertyRequest &request, std::shared_ptr<GetPropCallback> callback)
@ -134,7 +134,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,
uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
std::shared_ptr<UserAuthCallback> callback)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "Auth start");
@ -151,11 +151,11 @@ uint64_t UserAuth::Auth(const uint64_t challenge, const AuthType authType, const
USERAUTH_HILOGE(MODULE_INNERKIT, "Auth asyncStub is nullptr");
return GENERAL_ERROR;
}
return proxy_->Auth(challenge, authType, authTurstLevel, asyncStub);
return proxy_->Auth(challenge, authType, authTrustLevel, asyncStub);
}
uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, std::shared_ptr<UserAuthCallback> callback)
const AuthTrustLevel authTrustLevel, std::shared_ptr<UserAuthCallback> callback)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "AuthUser start");
if (callback == nullptr) {
@ -171,7 +171,7 @@ uint64_t UserAuth::AuthUser(const int32_t userId, const uint64_t challenge, cons
USERAUTH_HILOGE(MODULE_INNERKIT, "AuthUser asyncStub is nullptr");
return GENERAL_ERROR;
}
return proxy_->AuthUser(userId, challenge, authType, authTurstLevel, asyncStub);
return proxy_->AuthUser(userId, challenge, authType, authTrustLevel, asyncStub);
}
int32_t UserAuth::CancelAuth(const uint64_t contextId)

View File

@ -47,13 +47,13 @@ int32_t UserAuthAsyncStub::OnRemoteRequest(uint32_t code, MessageParcel &data, M
}
switch (code) {
case static_cast<int32_t>(IUserAuth::USER_AUTH_ACQUIRENFO):
case static_cast<int32_t>(IUserAuth::USER_AUTH_ACQUIRE_INFO):
return onAcquireInfoStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_ONRESULT):
case static_cast<int32_t>(IUserAuth::USER_AUTH_ON_RESULT):
return onResultStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_GETEXPORP):
case static_cast<int32_t>(IUserAuth::USER_AUTH_GET_EX_PROP):
return onExecutorPropertyInfoStub(data, reply);
case static_cast<int32_t>(IUserAuth::USER_AUTH_SETEXPORP):
case static_cast<int32_t>(IUserAuth::USER_AUTH_SET_EX_PROP):
return onSetExecutorPropertyStub(data, reply);
default:
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);

View File

@ -25,7 +25,7 @@ UserAuthProxy::UserAuthProxy(const sptr<IRemoteObject> &object) : IRemoteProxy<I
{
}
int32_t UserAuthProxy::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel)
int32_t UserAuthProxy::GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "UserAuthProxy GetAvailableStatus start");
int32_t result = SUCCESS;
@ -41,8 +41,8 @@ int32_t UserAuthProxy::GetAvailableStatus(const AuthType authType, const AuthTur
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authType");
return GENERAL_ERROR;
}
if (!data.WriteUint32(static_cast<uint32_t>(authTurstLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTurstLevel");
if (!data.WriteUint32(static_cast<uint32_t>(authTrustLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTrustLevel");
return GENERAL_ERROR;
}
bool ret = SendRequest(static_cast<int32_t>(IUserAuth::USER_AUTH_GET_AVAILABLE_STATUS), data, reply, option);
@ -125,7 +125,7 @@ void UserAuthProxy::SetProperty(const SetPropertyRequest request, sptr<IUserAuth
}
}
uint64_t UserAuthProxy::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
uint64_t UserAuthProxy::Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "UserAuthProxy Auth start");
@ -148,8 +148,8 @@ uint64_t UserAuthProxy::Auth(const uint64_t challenge, const AuthType authType,
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authType");
return invalidContextID;
}
if (!data.WriteUint32(static_cast<uint32_t>(authTurstLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTurstLevel");
if (!data.WriteUint32(static_cast<uint32_t>(authTrustLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTrustLevel");
return invalidContextID;
}
if (!data.WriteRemoteObject(callback->AsObject())) {
@ -169,7 +169,7 @@ uint64_t UserAuthProxy::Auth(const uint64_t challenge, const AuthType authType,
}
uint64_t UserAuthProxy::AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback)
const AuthTrustLevel authTrustLevel, sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGD(MODULE_INNERKIT, "UserAuthProxy AuthUser start");
const uint64_t invalidContextID = 0;
@ -194,8 +194,8 @@ uint64_t UserAuthProxy::AuthUser(const int32_t userId, const uint64_t challenge,
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authType");
return invalidContextID;
}
if (!data.WriteUint32(static_cast<uint32_t>(authTurstLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTurstLevel");
if (!data.WriteUint32(static_cast<uint32_t>(authTrustLevel))) {
USERAUTH_HILOGE(MODULE_INNERKIT, "failed to write authTrustLevel");
return invalidContextID;
}
if (!data.WriteRemoteObject(callback->AsObject())) {

View File

@ -84,7 +84,7 @@ struct ExecuteInfo {
bool isPromise;
napi_env env;
std::string type;
AuthTurstLevel trustLevel;
AuthTrustLevel trustLevel;
napi_ref callbackRef;
napi_deferred deferred;
napi_value promise;

View File

@ -215,10 +215,10 @@ napi_value AuthTrustLevelConstructor(napi_env env)
napi_value atl3 = nullptr;
napi_value atl4 = nullptr;
NAPI_CALL(env, napi_create_object(env, &authTrustLevel));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTurstLevel::ATL1), &atl1));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTurstLevel::ATL2), &atl2));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTurstLevel::ATL3), &atl3));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTurstLevel::ATL4), &atl4));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL1), &atl1));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL2), &atl2));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL3), &atl3));
NAPI_CALL(env, napi_create_int32(env, static_cast<int32_t>(AuthTrustLevel::ATL4), &atl4));
NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL1", atl1));
NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL2", atl2));
NAPI_CALL(env, napi_set_named_property(env, authTrustLevel, "ATL3", atl3));

View File

@ -68,8 +68,8 @@ napi_value UserAuthImpl::GetAvailableStatus(napi_env env, napi_callback_info inf
return ret;
}
AuthType authType = AuthType(type);
AuthTurstLevel authTurstLevel = AuthTurstLevel(level);
result = UserAuth::GetInstance().GetAvailableStatus(authType, authTurstLevel);
AuthTrustLevel authTrustLevel = AuthTrustLevel(level);
result = UserAuth::GetInstance().GetAvailableStatus(authType, authTrustLevel);
USERAUTH_HILOGI(MODULE_JS_NAPI, "GetAvailabeStatus result = %{public}d", result);
NAPI_CALL(env, napi_create_int32(env, result, &ret));
return ret;
@ -495,11 +495,11 @@ ResultCode UserAuthImpl::ParseExecuteParametersOne(napi_env env, size_t argc, na
USERAUTH_HILOGE(MODULE_JS_NAPI, "%{public}s argv[PARAM1] is not string", __func__);
return ResultCode::INVALID_PARAMETERS;
}
std::map<std::string, AuthTurstLevel> convertAuthTurstLevel = {
{ "S1", ATL1 },
{ "S2", ATL2 },
{ "S3", ATL3 },
{ "S4", ATL4 },
std::map<std::string, AuthTrustLevel> convertAuthTurstLevel = {
{"S1", ATL1},
{"S2", ATL2},
{"S3", ATL3},
{"S4", ATL4},
};
size_t len = 0;
napi_get_value_string_utf8(env, argv[PARAM1], nullptr, 0, &len);
@ -575,8 +575,8 @@ napi_value UserAuthImpl::AuthWrap(napi_env env, AuthInfo *authInfo)
}
std::shared_ptr<AuthApiCallback> callback;
callback.reset(object);
uint64_t result = UserAuth::GetInstance().Auth(
authInfo->challenge, AuthType(authInfo->authType), AuthTurstLevel(authInfo->authTrustLevel), callback);
uint64_t result = UserAuth::GetInstance().Auth(authInfo->challenge, AuthType(authInfo->authType),
AuthTrustLevel(authInfo->authTrustLevel), callback);
USERAUTH_HILOGI(MODULE_JS_NAPI, "UserAuth::GetInstance().Auth result = %{public}04" PRIx64 "", result);
napi_value key = authBuild.Uint64ToUint8Array(env, result);
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s end", __func__);
@ -649,7 +649,7 @@ napi_value UserAuthImpl::AuthUserWrap(napi_env env, AuthUserInfo *userInfo)
std::shared_ptr<AuthApiCallback> callback;
callback.reset(object);
uint64_t result = UserAuth::GetInstance().AuthUser(userInfo->userId, userInfo->challenge,
AuthType(userInfo->authType), AuthTurstLevel(userInfo->authTrustLevel), callback);
AuthType(userInfo->authType), AuthTrustLevel(userInfo->authTrustLevel), callback);
USERAUTH_HILOGI(MODULE_JS_NAPI, "UserAuth::GetInstance().AuthUser result = %{public}04" PRIx64 "", result);
napi_value key = authBuild.Uint64ToUint8Array(env, result);
USERAUTH_HILOGI(MODULE_JS_NAPI, "%{public}s, end.", __func__);

View File

@ -32,19 +32,19 @@ public:
USER_AUTH_AUTH_USER,
USER_AUTH_CANCEL_AUTH,
USER_AUTH_GET_VERSION,
USER_AUTH_ONRESULT,
USER_AUTH_GETEXPORP,
USER_AUTH_SETEXPORP,
USER_AUTH_ACQUIRENFO
USER_AUTH_ON_RESULT,
USER_AUTH_GET_EX_PROP,
USER_AUTH_SET_EX_PROP,
USER_AUTH_ACQUIRE_INFO
};
virtual int32_t GetAvailableStatus(const AuthType authType, AuthTurstLevel authTurstLevel) = 0;
virtual int32_t GetAvailableStatus(const AuthType authType, AuthTrustLevel authTrustLevel) = 0;
virtual void GetProperty(const GetPropertyRequest request, sptr<IUserAuthCallback> &callback) = 0;
virtual void SetProperty(const SetPropertyRequest request, sptr<IUserAuthCallback> &callback) = 0;
virtual uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
virtual uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
sptr<IUserAuthCallback> &callback) = 0;
virtual uint64_t AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback) = 0;
const AuthTrustLevel authTrustLevel, sptr<IUserAuthCallback> &callback) = 0;
virtual int32_t CancelAuth(const uint64_t contextId) = 0;
virtual int32_t GetVersion() = 0;

View File

@ -31,13 +31,13 @@ class UserAuth : public DelayedRefSingleton<UserAuth> {
public:
DISALLOW_COPY_AND_MOVE(UserAuth);
int32_t GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel);
int32_t GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel);
void GetProperty(const GetPropertyRequest &request, std::shared_ptr<GetPropCallback> callback);
void SetProperty(const SetPropertyRequest &request, std::shared_ptr<SetPropCallback> callback);
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
std::shared_ptr<UserAuthCallback> callback);
uint64_t AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, std::shared_ptr<UserAuthCallback> callback);
const AuthTrustLevel authTrustLevel, std::shared_ptr<UserAuthCallback> callback);
int32_t CancelAuth(const uint64_t contextId);
int32_t GetVersion();

View File

@ -40,12 +40,7 @@ enum AuthSubType : uint64_t {
FACE_3D = 20001
};
enum AuthTurstLevel : uint32_t {
ATL1 = 10000,
ATL2 = 20000,
ATL3 = 30000,
ATL4 = 40000
};
enum AuthTrustLevel : uint32_t { ATL1 = 10000, ATL2 = 20000, ATL3 = 30000, ATL4 = 40000 };
enum GetPropertyType : uint32_t {
AUTH_SUB_TYPE = 1,
@ -102,7 +97,7 @@ struct CoAuthInfo {
std::vector<uint64_t> sessionIds;
};
struct FreezInfo {
struct FreezeInfo {
uint64_t callerID;
std::string pkgName;
int32_t resultCode;
@ -128,7 +123,7 @@ enum ResultCode : int32_t {
LOCKED = 9,
NOT_ENROLLED = 10,
IPC_ERROR = 11,
INVALID_CONTEXTID = 12,
INVALID_CONTEXT_ID = 12,
E_WRITE_PARCEL_ERROR = 13,
E_READ_PARCEL_ERROR = 14,
E_GET_POWER_SERVICE_FAILED = 15,
@ -166,7 +161,7 @@ const std::map<int32_t, AuthenticationResult> result2ExecuteResult = {
{ResultCode::LOCKED, AuthenticationResult::LOCKED},
{ResultCode::NOT_ENROLLED, AuthenticationResult::NOT_ENROLLED},
{ResultCode::IPC_ERROR, AuthenticationResult::GENERAL_ERROR},
{ResultCode::INVALID_CONTEXTID, AuthenticationResult::GENERAL_ERROR},
{ResultCode::INVALID_CONTEXT_ID, AuthenticationResult::GENERAL_ERROR},
{ResultCode::E_WRITE_PARCEL_ERROR, AuthenticationResult::GENERAL_ERROR},
{ResultCode::E_READ_PARCEL_ERROR, AuthenticationResult::GENERAL_ERROR},
{ResultCode::E_GET_POWER_SERVICE_FAILED, AuthenticationResult::GENERAL_ERROR},

View File

@ -29,13 +29,13 @@ public:
explicit UserAuthProxy(const sptr<IRemoteObject> &object);
~UserAuthProxy() override = default;
int32_t GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel) override;
int32_t GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel) override;
void GetProperty(const GetPropertyRequest request, sptr<IUserAuthCallback> &callback) override;
void SetProperty(const SetPropertyRequest request, sptr<IUserAuthCallback> &callback) override;
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
sptr<IUserAuthCallback> &callback) override;
uint64_t AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback) override;
const AuthTrustLevel authTrustLevel, sptr<IUserAuthCallback> &callback) override;
int32_t CancelAuth(const uint64_t contextId) override;
int32_t GetVersion() override;

View File

@ -16,8 +16,10 @@
#ifndef USERAUTH_ADAPTER_H
#define USERAUTH_ADAPTER_H
#include <mutex>
#include "auth_attributes.h"
#include <mutex>
#include "co_auth.h"
#include "context_thread_pool.h"
#include "iuserauth_callback.h"
@ -32,22 +34,22 @@ class UserAuthAdapter {
public:
static UserAuthAdapter &GetInstance();
int32_t GetAuthTrustLevel(int32_t userId, uint32_t authType, uint32_t &authTrustLevel);
void GetPropAuthInfo(int32_t userId, uint64_t callerUid, std::string pkgName, GetPropertyRequest requset,
void GetPropAuthInfo(int32_t userId, uint64_t callerUid, std::string pkgName, GetPropertyRequest request,
sptr<IUserAuthCallback> &callback);
void CoauthSetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset);
void SetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest requset, std::vector<uint64_t> templateIds);
void GetPropAuthInfoCoauth(CallerInfo callerInfo, int32_t resultCode,
UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback);
void CoAuthSetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest request);
void SetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken, SetPropertyRequest request,
std::vector<uint64_t> templateIds);
void GetPropAuthInfoCoAuth(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
GetPropertyRequest request, 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,
std::vector<uint64_t> &sessionIds);
int32_t CancelContext(uint64_t contextId, std::vector<uint64_t> &sessionIds);
int32_t Cancel(uint64_t sessionId);
int32_t GetExecutorProp(uint64_t callerUid, std::string pkgName, uint64_t templateId, GetPropertyRequest requset,
int32_t GetExecutorProp(uint64_t callerUid, std::string pkgName, uint64_t templateId, GetPropertyRequest request,
ExecutorProperty &result);
int32_t SetExecutorProp(uint64_t callerUid, std::string pkgName, SetPropertyRequest requset,
int32_t SetExecutorProp(uint64_t callerUid, std::string pkgName, SetPropertyRequest request,
sptr<IUserAuthCallback> &callback);
int32_t GetVersion();
int32_t CoAuth(CoAuthInfo coAuthInfo, sptr<IUserAuthCallback> &callback);
@ -55,10 +57,10 @@ public:
private:
UserAuthAdapter() = default;
~UserAuthAdapter() = default;
int32_t GetEachExecutorProp(GetPropertyRequest &requset, ExecutorProperty &result, uint32_t &value,
int32_t GetEachExecutorProp(GetPropertyRequest &request, ExecutorProperty &result, uint32_t &value,
std::shared_ptr<OHOS::UserIAM::AuthResPool::AuthAttributes> pAuthAttributes);
int32_t SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes, CallerInfo callerInfo,
SetPropertyRequest requset, std::vector<uint64_t> templateIds,
SetPropertyRequest request, std::vector<uint64_t> templateIds,
std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback);
};
} // namespace UserAuth

View File

@ -39,8 +39,9 @@ public:
void OnAcquireInfo(uint32_t acquire) override;
void OnFinishHandle(uint32_t resultCode, std::vector<uint8_t> scheduleToken);
void OnAcquireInfoHandle(uint32_t acquire);
static int32_t SaveCoauthCallback(uint64_t contextId, std::shared_ptr<CoAuth::CoAuthCallback> coauthCallback);
static int32_t DeleteCoauthCallback(uint64_t contextId);
static int32_t SaveCoAuthCallback(uint64_t contextId, std::shared_ptr<CoAuth::CoAuthCallback> coauthCallback);
static int32_t DeleteCoAuthCallback(uint64_t contextId);
private:
void OnFinishHandleExtend(int32_t userId, SetPropertyRequest setPropertyRequest, AuthResult authResult,
int32_t ret, UserAuthToken authToken);
@ -56,8 +57,8 @@ private:
sptr<IUserAuthCallback> callback_ { nullptr };
AuthType authType_;
std::mutex mutex_;
static std::mutex coauthCallbackmutex_;
static std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> saveCoauthCallback_;
static std::mutex coAuthCallbackMutex_;
static std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> saveCoAuthCallback_;
};
class UserAuthCallbackImplSetProp : public CoAuth::SetPropCallback {
@ -71,11 +72,11 @@ private:
sptr<IUserAuthCallback> callback_ { nullptr };
};
class UserAuthCallbackImplSetPropFreez : public CoAuth::SetPropCallback {
class UserAuthCallbackImplSetPropFreeze : public CoAuth::SetPropCallback {
public:
explicit UserAuthCallbackImplSetPropFreez(std::vector<uint64_t> templateIds,
UserAuthToken authToken, FreezInfo freezInfo);
virtual ~UserAuthCallbackImplSetPropFreez() = default;
explicit UserAuthCallbackImplSetPropFreeze(std::vector<uint64_t> templateIds, UserAuthToken authToken,
FreezeInfo freezeInfo);
virtual ~UserAuthCallbackImplSetPropFreeze() = default;
void OnResult(uint32_t result, std::vector<uint8_t> &extraInfo) override;
@ -88,11 +89,11 @@ private:
uint64_t callerUid_;
};
class UserAuthCallbackImplIDMGetPorp : public UserIDM::GetInfoCallback {
class UserAuthCallbackImplIdmGetProp : public UserIDM::GetInfoCallback {
public:
explicit UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl,
GetPropertyRequest request, uint64_t callerUid, std::string pkgName);
virtual ~UserAuthCallbackImplIDMGetPorp() = default;
explicit UserAuthCallbackImplIdmGetProp(const sptr<IUserAuthCallback> &impl, GetPropertyRequest request,
uint64_t callerUid, std::string pkgName);
virtual ~UserAuthCallbackImplIdmGetProp() = default;
void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override;
@ -103,29 +104,27 @@ private:
uint64_t callerUid_;
};
class UserAuthCallbackImplIDMCothGetPorpFreez : public UserIDM::GetInfoCallback {
class UserAuthCallbackImpldmCothGetPropFreeze : public UserIDM::GetInfoCallback {
public:
explicit UserAuthCallbackImplIDMCothGetPorpFreez(
uint64_t callerUid, std::string pkgName, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset);
virtual ~UserAuthCallbackImplIDMCothGetPorpFreez() = default;
explicit UserAuthCallbackImpldmCothGetPropFreeze(uint64_t callerUid, std::string pkgName, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest request);
virtual ~UserAuthCallbackImpldmCothGetPropFreeze() = default;
void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override;
private:
UserAuthToken authToken_;
int32_t resultCode_;
SetPropertyRequest requset_;
SetPropertyRequest request_;
std::string pkgName_;
uint64_t callerUid_;
};
class UserAuthCallbackImplIDMGetPorpCoauth : public UserIDM::GetInfoCallback {
class UserAuthCallbackImplIdmGetPropCoAuth : public UserIDM::GetInfoCallback {
public:
explicit UserAuthCallbackImplIDMGetPorpCoauth(const sptr<IUserAuthCallback>& impl,
uint64_t callerUid, std::string pkgName, int32_t resultCode, UserAuthToken authToken,
GetPropertyRequest requset);
virtual ~UserAuthCallbackImplIDMGetPorpCoauth() = default;
explicit UserAuthCallbackImplIdmGetPropCoAuth(const sptr<IUserAuthCallback> &impl, uint64_t callerUid,
std::string pkgName, int32_t resultCode, UserAuthToken authToken, GetPropertyRequest request);
virtual ~UserAuthCallbackImplIdmGetPropCoAuth() = default;
void OnGetInfo(std::vector<UserIDM::CredentialInfo>& info) override;
@ -133,7 +132,7 @@ private:
sptr<IUserAuthCallback> callback_ { nullptr };
UserAuthToken authToken_;
int32_t resultCode_;
GetPropertyRequest requset_;
GetPropertyRequest request_;
std::string pkgName_;
uint64_t callerUid_;
};

View File

@ -36,13 +36,13 @@ public:
~UserAuthService() override;
void OnStart() override;
void OnStop() override;
int32_t GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel) override;
int32_t GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel) override;
void GetProperty(const GetPropertyRequest request, sptr<IUserAuthCallback> &callback) override;
void SetProperty(const SetPropertyRequest request, sptr<IUserAuthCallback> &callback) override;
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
uint64_t Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
sptr<IUserAuthCallback> &callback) override;
uint64_t AuthUser(const int32_t userId, const uint64_t challenge, const AuthType authType,
const AuthTurstLevel authTurstLevel, sptr<IUserAuthCallback> &callback) override;
const AuthTrustLevel authTrustLevel, sptr<IUserAuthCallback> &callback) override;
int32_t CancelAuth(const uint64_t contextId) override;
int32_t GetVersion() override;
@ -50,7 +50,7 @@ private:
int32_t GetCallingUserId(int32_t &userId);
bool CheckPermission(const std::string &permission);
int32_t GetControllerData(sptr<IUserAuthCallback> &callback, AuthResult &extraInfo,
const AuthTurstLevel authTurstLevel, uint64_t &callerId, std::string &callerName, uint64_t &contextId);
const AuthTrustLevel authTrustLevel, uint64_t &callerId, std::string &callerName, uint64_t &contextId);
class UserAuthServiceCallbackDeathRecipient : public IRemoteObject::DeathRecipient {
public:
explicit UserAuthServiceCallbackDeathRecipient(sptr<IUserAuthCallback> &impl);

View File

@ -46,13 +46,13 @@ 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)
GetPropertyRequest request, sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfo start");
using namespace UserIDM;
std::shared_ptr<GetInfoCallback> getInfoCallback =
std::make_shared<UserAuthCallbackImplIDMGetPorp>(callback, requset, callerUid, pkgName);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userId, static_cast<UserIDM::AuthType>(requset.authType),
std::make_shared<UserAuthCallbackImplIdmGetProp>(callback, request, callerUid, pkgName);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(userId, static_cast<UserIDM::AuthType>(request.authType),
getInfoCallback);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "GetAuthInfo failed");
@ -60,25 +60,25 @@ void UserAuthAdapter::GetPropAuthInfo(int32_t userId, uint64_t callerUid, std::s
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfo end");
}
void UserAuthAdapter::SetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset, std::vector<uint64_t> templateIds)
void UserAuthAdapter::SetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest request, std::vector<uint64_t> templateIds)
{
USERAUTH_HILOGI(MODULE_SERVICE, "SetPropAuthInfo start");
using namespace AuthResPool;
FreezInfo freezInfo;
freezInfo.callerID = callerInfo.callerUID;
freezInfo.authType = requset.authType;
freezInfo.pkgName = callerInfo.pkgName;
freezInfo.resultCode = resultCode;
FreezeInfo freezeInfo;
freezeInfo.callerID = callerInfo.callerUID;
freezeInfo.authType = request.authType;
freezeInfo.pkgName = callerInfo.pkgName;
freezeInfo.resultCode = resultCode;
std::shared_ptr<CoAuth::SetPropCallback> setPropCallback =
std::make_shared<UserAuthCallbackImplSetPropFreez>(templateIds, authToken, freezInfo);
std::make_shared<UserAuthCallbackImplSetPropFreeze>(templateIds, authToken, freezeInfo);
if (setPropCallback == nullptr) {
USERAUTH_HILOGE(MODULE_SERVICE, "SetPropAuthInfo setPropCallback nullptr");
return;
}
AuthAttributes authAttributes;
int32_t ret = SetProPropAuthInfo(authAttributes, callerInfo, requset, templateIds, setPropCallback);
int32_t ret = SetProPropAuthInfo(authAttributes, callerInfo, request, templateIds, setPropCallback);
if (ret != SUCCESS) {
return;
}
@ -87,18 +87,18 @@ void UserAuthAdapter::SetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode,
}
int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttributes &authAttributes,
CallerInfo callerInfo, SetPropertyRequest requset, std::vector<uint64_t> templateIds,
CallerInfo callerInfo, SetPropertyRequest request, std::vector<uint64_t> templateIds,
std::shared_ptr<CoAuth::SetPropCallback> &setPropCallback)
{
uint32_t value;
int32_t ret = authAttributes.SetUint32Value(AUTH_TYPE, requset.authType);
int32_t ret = authAttributes.SetUint32Value(AUTH_TYPE, request.authType);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "Set AUTH_TYPE failed");
std::vector<uint8_t> extraInfo;
setPropCallback->OnResult(ret, extraInfo);
return ret;
}
value = requset.key == SetPropertyType::FREEZE_TEMPLATE
value = request.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);
@ -136,34 +136,34 @@ int32_t UserAuthAdapter::SetProPropAuthInfo(OHOS::UserIAM::AuthResPool::AuthAttr
return ret;
}
void UserAuthAdapter::GetPropAuthInfoCoauth(CallerInfo callerInfo, int32_t resultCode,
UserAuthToken authToken, GetPropertyRequest requset, sptr<IUserAuthCallback> &callback)
void UserAuthAdapter::GetPropAuthInfoCoAuth(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
GetPropertyRequest request, sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfoCoauth start");
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfoCoAuth start");
using namespace UserIDM;
std::shared_ptr<GetInfoCallback> getInfoCallback = std::make_shared<UserAuthCallbackImplIDMGetPorpCoauth>(callback,
callerInfo.callerUID, callerInfo.pkgName, resultCode, authToken, requset);
std::shared_ptr<GetInfoCallback> getInfoCallback = std::make_shared<UserAuthCallbackImplIdmGetPropCoAuth>(callback,
callerInfo.callerUID, callerInfo.pkgName, resultCode, authToken, request);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(callerInfo.userID,
static_cast<UserIDM::AuthType>(requset.authType), getInfoCallback);
static_cast<UserIDM::AuthType>(request.authType), getInfoCallback);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "GetAuthInfo failed");
}
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfoCoauth end");
USERAUTH_HILOGI(MODULE_SERVICE, "GetPropAuthInfoCoAuth end");
}
void UserAuthAdapter::CoauthSetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset)
void UserAuthAdapter::CoAuthSetPropAuthInfo(CallerInfo callerInfo, int32_t resultCode, UserAuthToken authToken,
SetPropertyRequest request)
{
USERAUTH_HILOGI(MODULE_SERVICE, "CoauthSetPropAuthInfo start");
USERAUTH_HILOGI(MODULE_SERVICE, "CoAuthSetPropAuthInfo start");
using namespace UserIDM;
std::shared_ptr<GetInfoCallback> setPropCallback = std::make_shared<UserAuthCallbackImplIDMCothGetPorpFreez>(
callerInfo.callerUID, callerInfo.pkgName, resultCode, authToken, requset);
std::shared_ptr<GetInfoCallback> setPropCallback = std::make_shared<UserAuthCallbackImpldmCothGetPropFreeze>(
callerInfo.callerUID, callerInfo.pkgName, resultCode, authToken, request);
int32_t ret = UserIDMClient::GetInstance().GetAuthInfo(callerInfo.userID,
static_cast<UserIDM::AuthType>(requset.authType), setPropCallback);
static_cast<UserIDM::AuthType>(request.authType), setPropCallback);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "GetAuthInfo failed");
}
USERAUTH_HILOGI(MODULE_SERVICE, "CoauthSetPropAuthInfo end");
USERAUTH_HILOGI(MODULE_SERVICE, "CoAuthSetPropAuthInfo end");
}
int32_t UserAuthAdapter::GenerateSolution(AuthSolution param, std::vector<uint64_t> &sessionIds)
@ -217,7 +217,7 @@ int32_t UserAuthAdapter::GetVersion()
}
int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUid, std::string pkgName, uint64_t templateId,
GetPropertyRequest requset, ExecutorProperty &result)
GetPropertyRequest request, ExecutorProperty &result)
{
USERAUTH_HILOGI(MODULE_SERVICE, "GetExecutorProp start");
using namespace AuthResPool;
@ -225,7 +225,7 @@ int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUid, std::string pkgName
auto pAuthAttributes(std::make_shared<AuthAttributes>());
AuthAttributes cAuthAttributes;
int32_t ret = cAuthAttributes.SetUint32Value(AUTH_TYPE, requset.authType);
int32_t ret = cAuthAttributes.SetUint32Value(AUTH_TYPE, request.authType);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "Set AUTH_TYPE failed");
return ret;
@ -263,14 +263,14 @@ int32_t UserAuthAdapter::GetExecutorProp(uint64_t callerUid, std::string pkgName
result.result = ret;
return ret;
}
if (GetEachExecutorProp(requset, result, value, pAuthAttributes) != SUCCESS) {
if (GetEachExecutorProp(request, result, value, pAuthAttributes) != SUCCESS) {
return ret;
}
result.result = SUCCESS;
return ret;
}
int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, ExecutorProperty &result, uint32_t &value,
int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &request, ExecutorProperty &result, uint32_t &value,
std::shared_ptr<OHOS::UserIAM::AuthResPool::AuthAttributes> pAuthAttributes)
{
uint64_t tmpValue;
@ -279,7 +279,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut
result.freezingTime = 0;
result.remainTimes = 0;
result.authSubType = UserAuth::PIN_SIX;
for (auto const &item : requset.keys) {
for (auto const &item : request.keys) {
switch (item) {
case AUTH_SUB_TYPE:
ret = pAuthAttributes->GetUint64Value(AUTH_SUBTYPE, tmpValue);
@ -317,7 +317,7 @@ int32_t UserAuthAdapter::GetEachExecutorProp(GetPropertyRequest &requset, Execut
return ret;
}
int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUid, std::string pkgName, SetPropertyRequest requset,
int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUid, std::string pkgName, SetPropertyRequest request,
sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGI(MODULE_SERVICE, "SetExecutorProp start");
@ -326,7 +326,7 @@ int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUid, std::string pkgName
std::shared_ptr<CoAuth::SetPropCallback> setPropCallback = std::make_shared<UserAuthCallbackImplSetProp>(callback);
AuthAttributes authAttributes;
value = requset.key == SetPropertyType::INIT_ALGORITHM
value = request.key == SetPropertyType::INIT_ALGORITHM
? static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_INIT_ALGORITHM)
: static_cast<uint32_t>(AuthPropertyMode::PROPERMODE_RELEASE_ALGORITHM);
int32_t ret = authAttributes.SetUint32Value(AUTH_PROPERTY_MODE, value);
@ -348,12 +348,12 @@ int32_t UserAuthAdapter::SetExecutorProp(uint64_t callerUid, std::string pkgName
USERAUTH_HILOGE(MODULE_SERVICE, "Set AUTH_CALLER_NAME failed");
return ret;
}
ret = authAttributes.SetUint32Value(AUTH_TYPE, requset.authType);
ret = authAttributes.SetUint32Value(AUTH_TYPE, request.authType);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "Set AUTH_TYPE failed");
return ret;
}
ret = authAttributes.SetUint8ArrayValue(ALGORITHM_INFO, requset.setInfo);
ret = authAttributes.SetUint8ArrayValue(ALGORITHM_INFO, request.setInfo);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "Set ALGORITHM_INFO failed");
return ret;
@ -380,9 +380,9 @@ int32_t UserAuthAdapter::CoAuth(CoAuthInfo coAuthInfo, sptr<IUserAuthCallback> &
return ret;
}
ret = UserAuthCallbackImplCoAuth::SaveCoauthCallback(coAuthInfo.contextID, coAuthCallback);
ret = UserAuthCallbackImplCoAuth::SaveCoAuthCallback(coAuthInfo.contextID, coAuthCallback);
if (ret != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "SaveCoauthCallback failed");
USERAUTH_HILOGE(MODULE_SERVICE, "SaveCoAuthCallback failed");
return ret;
}
for (auto const &item : coAuthInfo.sessionIds) {

View File

@ -44,7 +44,7 @@ void UserAuthAsyncProxy::onAcquireInfo(const int32_t module, const uint32_t acqu
return;
}
bool ret = SendRequest(IUserAuth::USER_AUTH_ACQUIRENFO, data, reply);
bool ret = SendRequest(IUserAuth::USER_AUTH_ACQUIRE_INFO, data, reply);
if (ret) {
int32_t result = reply.ReadInt32();
USERAUTH_HILOGE(MODULE_SERVICE, "result = %{public}d", result);
@ -76,7 +76,7 @@ void UserAuthAsyncProxy::onResult(const int32_t result, const AuthResult extraIn
USERAUTH_HILOGE(MODULE_SERVICE, "failed to write freezingTime");
return;
}
bool ret = SendRequest(IUserAuth::USER_AUTH_ONRESULT, data, reply);
bool ret = SendRequest(IUserAuth::USER_AUTH_ON_RESULT, data, reply);
if (ret) {
int32_t result = reply.ReadInt32();
USERAUTH_HILOGE(MODULE_SERVICE, "result = %{public}d", result);
@ -108,7 +108,7 @@ void UserAuthAsyncProxy::onExecutorPropertyInfo(const ExecutorProperty result)
USERAUTH_HILOGE(MODULE_SERVICE, "failed to write freezingTime");
return;
}
bool ret = SendRequest(IUserAuth::USER_AUTH_GETEXPORP, data, reply);
bool ret = SendRequest(IUserAuth::USER_AUTH_GET_EX_PROP, data, reply);
if (ret) {
int32_t result = reply.ReadInt32();
USERAUTH_HILOGE(MODULE_SERVICE, "result = %{public}d", result);
@ -130,7 +130,7 @@ void UserAuthAsyncProxy::onSetExecutorProperty(const int32_t result)
return;
}
bool ret = SendRequest(IUserAuth::USER_AUTH_SETEXPORP, data, reply);
bool ret = SendRequest(IUserAuth::USER_AUTH_SET_EX_PROP, data, reply);
if (ret) {
int32_t result = reply.ReadInt32();
USERAUTH_HILOGE(MODULE_SERVICE, "result = %{public}d", result);

View File

@ -26,8 +26,8 @@
namespace OHOS {
namespace UserIAM {
namespace UserAuth {
std::mutex UserAuthCallbackImplCoAuth::coauthCallbackmutex_;
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> UserAuthCallbackImplCoAuth::saveCoauthCallback_;
std::mutex UserAuthCallbackImplCoAuth::coAuthCallbackMutex_;
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> UserAuthCallbackImplCoAuth::saveCoAuthCallback_;
UserAuthCallbackImplSetProp::UserAuthCallbackImplSetProp(const sptr<IUserAuthCallback>& impl)
{
@ -49,21 +49,21 @@ void UserAuthCallbackImplSetProp::OnResult(uint32_t result, std::vector<uint8_t>
}
}
UserAuthCallbackImplSetPropFreez::UserAuthCallbackImplSetPropFreez(std::vector<uint64_t> templateIds,
UserAuthToken authToken, FreezInfo freezInfo)
UserAuthCallbackImplSetPropFreeze::UserAuthCallbackImplSetPropFreeze(std::vector<uint64_t> templateIds,
UserAuthToken authToken, FreezeInfo freezeInfo)
{
templateIds_.clear();
templateIds_.assign(templateIds.begin(), templateIds.end());
resultCode_ = freezInfo.resultCode;
resultCode_ = freezeInfo.resultCode;
authToken_ = authToken;
authType_ = freezInfo.authType;
pkgName_ = freezInfo.pkgName;
callerUid_ = freezInfo.callerID;
authType_ = freezeInfo.authType;
pkgName_ = freezeInfo.pkgName;
callerUid_ = freezeInfo.callerID;
}
void UserAuthCallbackImplSetPropFreez::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
void UserAuthCallbackImplSetPropFreeze::OnResult(uint32_t result, std::vector<uint8_t> &extraInfo)
{
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetPropFreez result is %{public}u", result);
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplSetPropFreeze result is %{public}u", result);
}
UserAuthCallbackImplCoAuth::UserAuthCallbackImplCoAuth(const sptr<IUserAuthCallback>& impl,
@ -123,7 +123,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandleExtend(int32_t userId, SetPropert
callerInfo.callerUID = callerUid_;
callerInfo.userID = userId;
callerInfo.pkgName = pkgName_;
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(callerInfo, ret, authToken, setPropertyRequest);
UserAuthAdapter::GetInstance().CoAuthSetPropAuthInfo(callerInfo, ret, authToken, setPropertyRequest);
}
}
@ -135,7 +135,7 @@ void UserAuthCallbackImplCoAuth::DealFinishData(std::vector<uint64_t> sessionIds
}
}
UserAuthDataMgr::GetInstance().DeleteContextId(callbackContextId_);
UserAuthCallbackImplCoAuth::DeleteCoauthCallback(callbackContextId_);
UserAuthCallbackImplCoAuth::DeleteCoAuthCallback(callbackContextId_);
isResultDoneFlag_ = true;
return;
}
@ -167,7 +167,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
if (callbackNowCount_ == callbackCount_) {
USERAUTH_HILOGD(MODULE_SERVICE, "RequestAuthResult E_RET_UNDONE");
UserAuthDataMgr::GetInstance().DeleteContextId(callbackContextId_);
UserAuthCallbackImplCoAuth::DeleteCoauthCallback(callbackContextId_);
UserAuthCallbackImplCoAuth::DeleteCoAuthCallback(callbackContextId_);
callback_->onResult(GENERAL_ERROR, authResult);
isResultDoneFlag_ = true;
}
@ -177,8 +177,7 @@ void UserAuthCallbackImplCoAuth::OnFinishHandle(uint32_t resultCode, std::vector
USERAUTH_HILOGD(MODULE_SERVICE, "resultCode is LOCKED");
setPropertyRequest.authType = FACE;
setPropertyRequest.key = SetPropertyType::FREEZE_TEMPLATE;
UserAuthAdapter::GetInstance().CoauthSetPropAuthInfo(callerInfo, resultCode, authToken,
setPropertyRequest);
UserAuthAdapter::GetInstance().CoAuthSetPropAuthInfo(callerInfo, resultCode, authToken, setPropertyRequest);
}
if (ret == SUCCESS) {
OnFinishHandleExtend(userId_, setPropertyRequest, authResult, ret, authToken);
@ -186,8 +185,8 @@ 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(callerInfo, resultCode,
authToken, getPropertyRequest, callback_);
UserAuthAdapter::GetInstance().GetPropAuthInfoCoAuth(callerInfo, resultCode, authToken, getPropertyRequest,
callback_);
DealFinishData(sessionIds);
}
@ -204,12 +203,12 @@ void UserAuthCallbackImplCoAuth::OnAcquireInfoHandle(uint32_t acquire)
callback_->onAcquireInfo(module, acquireInfo, extraInfo);
}
int32_t UserAuthCallbackImplCoAuth::SaveCoauthCallback(uint64_t contextId,
int32_t UserAuthCallbackImplCoAuth::SaveCoAuthCallback(uint64_t contextId,
std::shared_ptr<CoAuth::CoAuthCallback> coauthCallback)
{
std::lock_guard<std::mutex> lock(coauthCallbackmutex_);
saveCoauthCallback_.insert(std::make_pair(contextId, coauthCallback));
if (saveCoauthCallback_.begin() != saveCoauthCallback_.end()) {
std::lock_guard<std::mutex> lock(coAuthCallbackMutex_);
saveCoAuthCallback_.insert(std::make_pair(contextId, coauthCallback));
if (saveCoAuthCallback_.begin() != saveCoAuthCallback_.end()) {
USERAUTH_HILOGD(MODULE_SERVICE, "Save coauth callback success");
return SUCCESS;
}
@ -217,12 +216,12 @@ int32_t UserAuthCallbackImplCoAuth::SaveCoauthCallback(uint64_t contextId,
return FAIL;
}
int32_t UserAuthCallbackImplCoAuth::DeleteCoauthCallback(uint64_t contextId)
int32_t UserAuthCallbackImplCoAuth::DeleteCoAuthCallback(uint64_t contextId)
{
std::lock_guard<std::mutex> lock(coauthCallbackmutex_);
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>> ::iterator iter = saveCoauthCallback_.find(contextId);
if (iter != saveCoauthCallback_.end()) {
saveCoauthCallback_.erase(iter);
std::lock_guard<std::mutex> lock(coAuthCallbackMutex_);
std::map<uint64_t, std::shared_ptr<CoAuth::CoAuthCallback>>::iterator iter = saveCoAuthCallback_.find(contextId);
if (iter != saveCoAuthCallback_.end()) {
saveCoAuthCallback_.erase(iter);
USERAUTH_HILOGD(MODULE_SERVICE, "contextId XXXX%{public}04" PRIx64 " is deleted", contextId);
return SUCCESS;
}
@ -230,11 +229,11 @@ int32_t UserAuthCallbackImplCoAuth::DeleteCoauthCallback(uint64_t contextId)
return FAIL;
}
UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserAuthCallback>& impl,
UserAuthCallbackImplIdmGetProp::UserAuthCallbackImplIdmGetProp(const sptr<IUserAuthCallback> &impl,
GetPropertyRequest request, uint64_t callerUID, std::string pkgName)
{
if (impl == nullptr) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorp impl callback is nullptr");
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthCallbackImplIdmGetProp impl callback is nullptr");
return;
}
callback_ = impl;
@ -245,9 +244,9 @@ UserAuthCallbackImplIDMGetPorp::UserAuthCallbackImplIDMGetPorp(const sptr<IUserA
callerUid_ = callerUID;
}
void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
void UserAuthCallbackImplIdmGetProp::OnGetInfo(std::vector<UserIDM::CredentialInfo> &info)
{
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorp OnGetInfo start");
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIdmGetProp OnGetInfo start");
ExecutorProperty executorProperty = {};
if (info.size() == 0) {
executorProperty.result = FAIL;
@ -262,29 +261,28 @@ void UserAuthCallbackImplIDMGetPorp::OnGetInfo(std::vector<UserIDM::CredentialIn
callback_->onExecutorPropertyInfo(executorProperty);
}
UserAuthCallbackImplIDMCothGetPorpFreez::UserAuthCallbackImplIDMCothGetPorpFreez(
uint64_t callerUid, std::string pkgName, int32_t resultCode,
UserAuthToken authToken, SetPropertyRequest requset)
UserAuthCallbackImpldmCothGetPropFreeze::UserAuthCallbackImpldmCothGetPropFreeze(uint64_t callerUid,
std::string pkgName, int32_t resultCode, UserAuthToken authToken, SetPropertyRequest request)
{
authToken_ = authToken;
resultCode_ = resultCode;
requset_ = requset;
request_ = request;
pkgName_ = pkgName;
callerUid_ = callerUid;
}
void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
void UserAuthCallbackImpldmCothGetPropFreeze::OnGetInfo(std::vector<UserIDM::CredentialInfo> &info)
{
CallerInfo callerInfo;
callerInfo.callerUID = callerUid_;
callerInfo.userID = 0;
callerInfo.pkgName = pkgName_;
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMCothGetPorpFreez OnGetInfo start");
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImpldmCothGetPropFreeze OnGetInfo start");
std::vector<uint64_t> templateIds;
AuthResult authResult;
if (info.size() == 0) {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMCothGetPorpFreez OnGetInfo no data");
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImpldmCothGetPropFreeze OnGetInfo no data");
authResult.token.resize(sizeof(UserAuthToken));
if (memcpy_s(&authResult.token[0], authResult.token.size(), &authToken_, sizeof(UserAuthToken)) != EOK) {
USERAUTH_HILOGE(MODULE_SERVICE, "copy authToken_ error");
@ -295,33 +293,31 @@ void UserAuthCallbackImplIDMCothGetPorpFreez::OnGetInfo(std::vector<UserIDM::Cre
for (auto const &item : info) {
templateIds.push_back(item.templateId);
}
UserAuthAdapter::GetInstance().SetPropAuthInfo(callerInfo, resultCode_, authToken_, requset_,
templateIds);
UserAuthAdapter::GetInstance().SetPropAuthInfo(callerInfo, resultCode_, authToken_, request_, templateIds);
}
UserAuthCallbackImplIDMGetPorpCoauth::UserAuthCallbackImplIDMGetPorpCoauth(
const sptr<IUserAuthCallback>& impl, uint64_t callerUid, std::string pkgName, int32_t resultCode,
UserAuthToken authToken, GetPropertyRequest requset)
UserAuthCallbackImplIdmGetPropCoAuth::UserAuthCallbackImplIdmGetPropCoAuth(const sptr<IUserAuthCallback> &impl,
uint64_t callerUid, std::string pkgName, int32_t resultCode, UserAuthToken authToken, GetPropertyRequest request)
{
if (impl == nullptr) {
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth impl callback is nullptr");
USERAUTH_HILOGE(MODULE_SERVICE, "UserAuthCallbackImplIdmGetPropCoAuth impl callback is nullptr");
return;
}
callback_ = impl;
authToken_ = authToken;
resultCode_ = resultCode;
requset_ = requset;
request_ = request;
pkgName_ = pkgName;
callerUid_ = callerUid;
}
void UserAuthCallbackImplIDMGetPorpCoauth::OnGetInfo(std::vector<UserIDM::CredentialInfo>& info)
void UserAuthCallbackImplIdmGetPropCoAuth::OnGetInfo(std::vector<UserIDM::CredentialInfo> &info)
{
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth OnGetInfo start");
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIdmGetPropCoAuth OnGetInfo start");
ExecutorProperty executorProperty;
AuthResult authResult;
if (info.size() == 0) {
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIDMGetPorpCoauth OnGetInfo no data");
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthCallbackImplIdmGetPropCoAuth OnGetInfo no data");
executorProperty.result = GENERAL_ERROR;
authResult.token.resize(sizeof(UserAuthToken));
if (memcpy_s(&authResult.token[0], authResult.token.size(), &authToken_, sizeof(UserAuthToken)) != EOK) {
@ -333,7 +329,7 @@ void UserAuthCallbackImplIDMGetPorpCoauth::OnGetInfo(std::vector<UserIDM::Creden
return;
}
uint64_t tmp = info.begin()->templateId;
int32_t ret = UserAuthAdapter::GetInstance().GetExecutorProp(callerUid_, pkgName_, tmp, requset_, executorProperty);
int32_t ret = UserAuthAdapter::GetInstance().GetExecutorProp(callerUid_, pkgName_, tmp, request_, executorProperty);
if (ret != SUCCESS) {
executorProperty.freezingTime = 0;
executorProperty.remainTimes = 0;

View File

@ -22,7 +22,7 @@
namespace OHOS {
namespace UserIAM {
namespace UserAuth {
const static int AUTHTURSTLEVEL_SYS = 1;
const static int AUTH_TRUST_LEVEL_SYS = 1;
static const std::string ACCESS_USER_AUTH_INTERNAL_PERMISSION = "ohos.permission.ACCESS_USER_AUTH_INTERNAL";
static const std::string ACCESS_BIOMETRIC_PERMISSION = "ohos.permission.ACCESS_BIOMETRIC";
@ -73,7 +73,7 @@ bool UserAuthService::CheckPermission(const std::string &permission)
return AccessTokenKit::VerifyAccessToken(tokenId, permission) == RET_SUCCESS;
}
int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthTurstLevel authTurstLevel)
int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthTrustLevel authTrustLevel)
{
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService GetAvailableStatus start");
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) &&
@ -82,9 +82,9 @@ int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthT
return E_CHECK_PERMISSION_FAILED;
}
int32_t userId = 0;
uint32_t authTurstLevelFromSys = AUTHTURSTLEVEL_SYS;
if (authTurstLevel > ATL4 || authTurstLevel < ATL1) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTurstLevel not right");
uint32_t authTrustLevelFromSys = AUTH_TRUST_LEVEL_SYS;
if (authTrustLevel > ATL4 || authTrustLevel < ATL1) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTrustLevel not right");
return TRUST_LEVEL_NOT_SUPPORT;
}
@ -94,13 +94,12 @@ int32_t UserAuthService::GetAvailableStatus(const AuthType authType, const AuthT
return ret;
}
ret = userAuthController_.GetAuthTrustLevel(userId, authType, authTurstLevelFromSys);
ret = userAuthController_.GetAuthTrustLevel(userId, authType, authTrustLevelFromSys);
if (ret == SUCCESS) {
USERAUTH_HILOGD(MODULE_SERVICE,
"authTurstLevelFromSys:%{public}u, authTurstLevel:%{public}u",
authTurstLevelFromSys, authTurstLevel);
if (authTurstLevelFromSys < authTurstLevel) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTurstLevel not support");
USERAUTH_HILOGD(MODULE_SERVICE, "authTrustLevelFromSys:%{public}u, authTrustLevel:%{public}u",
authTrustLevelFromSys, authTrustLevel);
if (authTrustLevelFromSys < authTrustLevel) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTrustLevel not support");
return TRUST_LEVEL_NOT_SUPPORT;
}
}
@ -208,7 +207,7 @@ static AuthSolution GetSolutionParam(uint64_t contextId, int32_t userId, uint64_
return authSolutionParam;
}
uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType, const AuthTurstLevel authTurstLevel,
uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType, const AuthTrustLevel authTrustLevel,
sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService Auth start");
@ -225,7 +224,7 @@ uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType
USERAUTH_HILOGE(MODULE_SERVICE, "Failed to add death recipient UserAuthServiceCallbackDeathRecipient");
}
if (GetControllerData(callback, extraInfo, authTurstLevel, callerId, callerName, contextId) == FAIL) {
if (GetControllerData(callback, extraInfo, authTrustLevel, callerId, callerName, contextId) == FAIL) {
return invalidContextId;
}
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) &&
@ -240,7 +239,7 @@ uint64_t UserAuthService::Auth(const uint64_t challenge, const AuthType authType
return invalidContextId;
}
AuthSolution authSolutionParam = GetSolutionParam(contextId, userId, challenge, authType, authTurstLevel);
AuthSolution authSolutionParam = GetSolutionParam(contextId, userId, challenge, authType, authTrustLevel);
result = userAuthController_.GenerateSolution(authSolutionParam, coAuthInfo.sessionIds);
if (result != SUCCESS) {
USERAUTH_HILOGE(MODULE_SERVICE, "GenerateSolution failed");
@ -263,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)
const AuthTrustLevel authTrustLevel, sptr<IUserAuthCallback> &callback)
{
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService AuthUser start");
const uint64_t invalidContextId = 0;
@ -284,13 +283,13 @@ uint64_t UserAuthService::AuthUser(const int32_t userId, const uint64_t challeng
callback->onResult(E_CHECK_PERMISSION_FAILED, extraInfo);
return invalidContextId;
}
if (GetControllerData(callback, extraInfo, authTurstLevel, callerId, callerName, contextId) == FAIL) {
if (GetControllerData(callback, extraInfo, authTrustLevel, callerId, callerName, contextId) == FAIL) {
return invalidContextId;
}
authSolutionParam.contextId = contextId;
authSolutionParam.userId = userId;
authSolutionParam.authTrustLevel = authTurstLevel;
authSolutionParam.authTrustLevel = authTrustLevel;
authSolutionParam.challenge = challenge;
authSolutionParam.authType = authType;
int32_t result = userAuthController_.GenerateSolution(authSolutionParam, coAuthInfo.sessionIds);
@ -317,14 +316,14 @@ uint64_t UserAuthService::AuthUser(const int32_t userId, const uint64_t challeng
}
int32_t UserAuthService::GetControllerData(sptr<IUserAuthCallback> &callback, AuthResult &extraInfo,
const AuthTurstLevel authTurstLevel, uint64_t &callerId, std::string &callerName, uint64_t &contextId)
const AuthTrustLevel authTrustLevel, uint64_t &callerId, std::string &callerName, uint64_t &contextId)
{
if (callback == nullptr) {
USERAUTH_HILOGE(MODULE_SERVICE, "callback is nullptr");
return FAIL;
}
if (ATL4 < authTurstLevel || authTurstLevel < ATL1) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTurstLevel is not right");
if (ATL4 < authTrustLevel || authTrustLevel < ATL1) {
USERAUTH_HILOGE(MODULE_SERVICE, "authTrustLevel is not right");
callback->onResult(TRUST_LEVEL_NOT_SUPPORT, extraInfo);
return FAIL;
}
@ -348,7 +347,7 @@ int32_t UserAuthService::GetControllerData(sptr<IUserAuthCallback> &callback, Au
int32_t UserAuthService::CancelAuth(const uint64_t contextId)
{
USERAUTH_HILOGI(MODULE_SERVICE, "UserAuthService CancelAuth start");
int result = INVALID_CONTEXTID;
int result = INVALID_CONTEXT_ID;
std::vector<uint64_t> sessionIds;
if (!CheckPermission(ACCESS_USER_AUTH_INTERNAL_PERMISSION) && !CheckPermission(ACCESS_BIOMETRIC_PERMISSION)) {
USERAUTH_HILOGE(MODULE_SERVICE, "Permission check failed");

View File

@ -55,19 +55,19 @@ int32_t UserAuthStub::GetAvailableStatusStub(MessageParcel &data, MessageParcel
{
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthStub GetAvailableStatusStub start");
uint32_t authType;
uint32_t authTurstLevel;
uint32_t authTrustLevel;
int32_t ret = GENERAL_ERROR;
if (!data.ReadUint32(authType)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authType");
return E_READ_PARCEL_ERROR;
}
if (!data.ReadUint32(authTurstLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTurstLevel");
if (!data.ReadUint32(authTrustLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTrustLevel");
return E_READ_PARCEL_ERROR;
}
ret = GetAvailableStatus(static_cast<AuthType>(authType), static_cast<AuthTurstLevel>(authTurstLevel));
ret = GetAvailableStatus(static_cast<AuthType>(authType), static_cast<AuthTrustLevel>(authTrustLevel));
if (!reply.WriteInt32(ret)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to write GetAvailableStatus result");
return E_WRITE_PARCEL_ERROR;
@ -153,7 +153,7 @@ int32_t UserAuthStub::AuthStub(MessageParcel &data, MessageParcel &reply)
USERAUTH_HILOGD(MODULE_SERVICE, "UserAuthStub AuthStub start");
uint64_t challenge;
uint32_t authType;
uint32_t authTurstLevel;
uint32_t authTrustLevel;
uint64_t ret = SUCCESS;
if (!data.ReadUint64(challenge)) {
@ -164,8 +164,8 @@ int32_t UserAuthStub::AuthStub(MessageParcel &data, MessageParcel &reply)
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authType");
return E_READ_PARCEL_ERROR;
}
if (!data.ReadUint32(authTurstLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTurstLevel");
if (!data.ReadUint32(authTrustLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTrustLevel");
return E_READ_PARCEL_ERROR;
}
@ -179,7 +179,7 @@ int32_t UserAuthStub::AuthStub(MessageParcel &data, MessageParcel &reply)
return FAIL;
}
ret = Auth(challenge, static_cast<AuthType>(authType), static_cast<AuthTurstLevel>(authTurstLevel), callback);
ret = Auth(challenge, static_cast<AuthType>(authType), static_cast<AuthTrustLevel>(authTrustLevel), callback);
if (!reply.WriteUint64(ret)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to write Auth result");
return E_WRITE_PARCEL_ERROR;
@ -194,7 +194,7 @@ int32_t UserAuthStub::AuthUserStub(MessageParcel &data, MessageParcel &reply)
int32_t userId;
uint64_t challenge;
uint32_t authType;
uint32_t authTurstLevel;
uint32_t authTrustLevel;
if (!data.ReadInt32(userId)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read userId");
@ -208,8 +208,8 @@ int32_t UserAuthStub::AuthUserStub(MessageParcel &data, MessageParcel &reply)
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authType");
return E_READ_PARCEL_ERROR;
}
if (!data.ReadUint32(authTurstLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTurstLevel");
if (!data.ReadUint32(authTrustLevel)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to read authTrustLevel");
return E_READ_PARCEL_ERROR;
}
@ -223,8 +223,8 @@ int32_t UserAuthStub::AuthUserStub(MessageParcel &data, MessageParcel &reply)
return FAIL;
}
uint64_t ret = AuthUser(userId, challenge,
static_cast<AuthType>(authType), static_cast<AuthTurstLevel>(authTurstLevel), callback);
uint64_t ret = AuthUser(userId, challenge, static_cast<AuthType>(authType),
static_cast<AuthTrustLevel>(authTrustLevel), callback);
if (!reply.WriteUint64(ret)) {
USERAUTH_HILOGE(MODULE_SERVICE, "failed to write AuthUser result");
return E_WRITE_PARCEL_ERROR;

View File

@ -99,8 +99,8 @@ void TestSetPropCallback::onSetProperty(const int32_t result)
HWTEST_F(UseriamUtTest, UseriamUtTest_001, TestSize.Level1)
{
AuthType authType = FACE;
AuthTurstLevel authTurstLevel = ATL1;
EXPECT_NE(0, UserAuth::GetInstance().GetAvailableStatus(authType, authTurstLevel));
AuthTrustLevel authTrustLevel = ATL1;
EXPECT_NE(0, UserAuth::GetInstance().GetAvailableStatus(authType, authTrustLevel));
}
HWTEST_F(UseriamUtTest, UseriamUtTest_002, TestSize.Level1)
@ -128,9 +128,9 @@ HWTEST_F(UseriamUtTest, UseriamUtTest_004, TestSize.Level1)
{
uint64_t challenge = 001;
AuthType authType = FACE;
AuthTurstLevel authTurstLevel = ATL1;
AuthTrustLevel authTrustLevel = ATL1;
std::shared_ptr<UserAuthCallback> callback = std::make_shared<TestUserAuthCallback>();
EXPECT_EQ(0, UserAuth::GetInstance().Auth(challenge, authType, authTurstLevel, callback));
EXPECT_EQ(0, UserAuth::GetInstance().Auth(challenge, authType, authTrustLevel, callback));
}
HWTEST_F(UseriamUtTest, UseriamUtTest_005, TestSize.Level1)
@ -138,9 +138,9 @@ HWTEST_F(UseriamUtTest, UseriamUtTest_005, TestSize.Level1)
int32_t userId = 0;
uint64_t challenge = 001;
AuthType authType = FACE;
AuthTurstLevel authTurstLevel = ATL1;
AuthTrustLevel authTrustLevel = ATL1;
std::shared_ptr<UserAuthCallback> callback = std::make_shared<TestUserAuthCallback>();
EXPECT_EQ(0, UserAuth::GetInstance().AuthUser(userId, challenge, authType, authTurstLevel, callback));
EXPECT_EQ(0, UserAuth::GetInstance().AuthUser(userId, challenge, authType, authTrustLevel, callback));
}
HWTEST_F(UseriamUtTest, UseriamUtTest_006, TestSize.Level1)