diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 184e2e1fcbf89573d81752169c3b772a7331a065..62c002170b3d4752cddcd4a801acc62e6bc7768e 100644 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -140,6 +140,9 @@ const std::string AUTH_TYPE = "authType"; const std::string TOKEN = "token"; const std::string PIN_TOKEN = "pinToken"; const std::string PIN_CODE_KEY = "pinCode"; +const std::string NFC_CODE_KEY = "nfcCode"; +const std::string QR_CODE_KEY = "qrCode"; +const std::string TAG_AUTH_TOKEN = "authToken"; const int32_t AUTH_TYPE_PIN = 1; const int32_t AUTH_TYPE_SCAN = 2; const int32_t AUTH_TYPE_TOUCH = 3; diff --git a/ext/pin_auth/include/pin_auth.h b/ext/pin_auth/include/pin_auth.h index dca2e7e7f9e12b4679d778c7d4a9b893f46c129d..ac02b101789ce4aad956095c5acf6fd32cbedb56 100644 --- a/ext/pin_auth/include/pin_auth.h +++ b/ext/pin_auth/include/pin_auth.h @@ -30,10 +30,9 @@ class PinAuth : public IAuthentication { public: PinAuth(); ~PinAuth(); - int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) override; - int32_t StartAuth(int32_t code, std::shared_ptr authManager) override; - int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) override; - + int32_t ShowAuthInfo(std::string &authToken, std::shared_ptr authManager) override; + int32_t StartAuth(std::string &authToken, std::shared_ptr authManager) override; + int32_t VerifyAuthentication(std::string &authToken, const std::string &authParam) override; private: int32_t times_ = 0; std::shared_ptr pinAuthUi_; diff --git a/ext/pin_auth/src/pin_auth.cpp b/ext/pin_auth/src/pin_auth.cpp index 0bbadd15f7aa503e771432a132e9512f1834eec8..15c52772ca41c5f8de857b05d52db09ebfe4d026 100644 --- a/ext/pin_auth/src/pin_auth.cpp +++ b/ext/pin_auth/src/pin_auth.cpp @@ -33,31 +33,59 @@ PinAuth::~PinAuth() { } -int32_t PinAuth::ShowAuthInfo(int32_t code, std::shared_ptr authManager) +int32_t PinAuth::ShowAuthInfo(std::string &authToken, std::shared_ptr authManager) { - return pinAuthUi_->ShowPinDialog(code, authManager); + nlohmann::json jsonObject = nlohmann::json::parse(authToken, nullptr, false); + if (jsonObject.is_discarded()) { + LOGE("DecodeRequestAuth jsonStr error"); + return DM_FAILED; + } + if (!jsonObject.contains(PIN_CODE_KEY)) { + LOGE("err json string, first time"); + return DM_FAILED; + } + return pinAuthUi_->ShowPinDialog(jsonObject[PIN_CODE_KEY], authManager); } -int32_t PinAuth::StartAuth(int32_t code, std::shared_ptr authManager) +int32_t PinAuth::StartAuth(std::string &authToken, std::shared_ptr authManager) { - return pinAuthUi_->InputPinDialog(code, authManager); + nlohmann::json jsonObject = nlohmann::json::parse(authToken, nullptr, false); + if (jsonObject.is_discarded()) { + LOGE("DecodeRequestAuth jsonStr error"); + return DM_FAILED; + } + if (!jsonObject.contains(PIN_CODE_KEY)) { + LOGE("err json string, first time"); + return DM_FAILED; + } + return pinAuthUi_->InputPinDialog(jsonObject[PIN_CODE_KEY], authManager); } -int32_t PinAuth::VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) +int32_t PinAuth::VerifyAuthentication(std::string &authToken, const std::string &authParam) { times_ += 1; - nlohmann::json jsonObject = nlohmann::json::parse(authParam, nullptr, false); - if (jsonObject.is_discarded()) { + nlohmann::json authParamJson = nlohmann::json::parse(authParam, nullptr, false); + if (authParamJson.is_discarded()) { + LOGE("DecodeRequestAuth jsonStr error"); + return DM_FAILED; + } + nlohmann::json authTokenJson = nlohmann::json::parse(authToken, nullptr, false); + if (authParamJson.is_discarded()) { LOGE("DecodeRequestAuth jsonStr error"); return DM_FAILED; } - if (!jsonObject.contains(PIN_CODE_KEY) && !jsonObject.contains(PIN_TOKEN)) { + if (!authParamJson.contains(PIN_CODE_KEY) && !authParamJson.contains(PIN_TOKEN)) { + if (authParam == "0") { + return DM_OK; + } LOGE("err json string, first time"); return DM_FAILED; } - int32_t inputPinCode = jsonObject[PIN_CODE_KEY]; - int32_t inputPinToken = jsonObject[PIN_TOKEN]; - if (code == inputPinCode && stoi(pinToken) == inputPinToken) { + int32_t code = authTokenJson[PIN_CODE_KEY]; + int32_t pinToken = authTokenJson[PIN_TOKEN]; + int32_t inputPinCode = authParamJson[PIN_CODE_KEY]; + int32_t inputPinToken = authParamJson[PIN_TOKEN]; + if (code == inputPinCode && pinToken == inputPinToken) { return DM_OK; } else if (code != inputPinCode && times_ < MAX_VERIFY_TIMES) { return DM_AUTH_INPUT_FAILED; diff --git a/ext/pin_auth/src/pin_auth_ui.cpp b/ext/pin_auth/src/pin_auth_ui.cpp index 9fc3459cda10a015720e9c8184833825b398c14f..eb976a67898c97ed963f8228bf400323baa920f8 100644 --- a/ext/pin_auth/src/pin_auth_ui.cpp +++ b/ext/pin_auth/src/pin_auth_ui.cpp @@ -43,7 +43,7 @@ int32_t PinAuthUi::ShowPinDialog(int32_t code, std::shared_ptr au ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT, [authManager](int32_t id, const std::string& event, const std::string& params) { if (strcmp(params.c_str(), "0") == 0) { - authManager->ClosePage(id); + authManager->SetPageId(id); } if (strcmp(params.c_str(), "1") == 0) { LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); @@ -69,12 +69,12 @@ int32_t PinAuthUi::InputPinDialog(int32_t code, std::shared_ptr a ACE_X, ACE_Y, ACE_WIDTH, ACE_HEIGHT, [authManager](int32_t id, const std::string& event, const std::string& params) { if (strcmp(params.c_str(), "2") == 0) { - authManager->ClosePage(id); + authManager->SetPageId(id); } if (strcmp(params.c_str(), "0") == 0 || strcmp(params.c_str(), "1") == 0) { Ace::UIServiceMgrClient::GetInstance()->CancelDialog(id); LOGI("CancelDialog start id:%d,event:%s,parms:%s", id, event.c_str(), params.c_str()); - authManager->VerifyPinAuthAuthentication(params.c_str()); + authManager->VerifyAuthentication(params.c_str()); } }); LOGI("ShowConfigDialog end"); diff --git a/ext/profile/BUILD.gn b/ext/profile/BUILD.gn index 552653a03c2077c3eea4b5b85534e18fc34c5e57..9dfe54e45e01efe71194329923d12f68c5167a08 100644 --- a/ext/profile/BUILD.gn +++ b/ext/profile/BUILD.gn @@ -30,7 +30,15 @@ if (defined(ohos_lite)) { "${ext_path}/profile/include", "${services_path}/include", "${services_path}/include/adapter", + "${services_path}/include/authentication", + "${services_path}/include/ability", + "${services_path}/include/deviceinfo", + "${services_path}/include/devicestate", + "${services_path}/include/discovery", + "${services_path}/include/dependency/commonevent", + "${services_path}/include/dependency/hichain", "${services_path}/include/dependency/softbus", + "${services_path}/include/dependency/timer", "${services_path}/include/ipc/standard", "${services_path}/include/devicestate", "${utils_path}/include", @@ -38,11 +46,12 @@ if (defined(ohos_lite)) { "${innerkits_path}/native_cpp/include", "${innerkits_path}/native_cpp/include/ipc", "${innerkits_path}/native_cpp/include/ipc/standard", - "//foundation/communication/dsoftbus/interfaces/kits/bus_center", - "//foundation/communication/dsoftbus/interfaces/kits/common", - "//foundation/communication/dsoftbus/interfaces/kits/discovery", - "//foundation/communication/dsoftbus/interfaces/kits/transport", - "//foundation/communication/dsoftbus/interfaces/inner_kits/transport", + + "//base/notification/ces_standard/frameworks/core/include", + "//base/notification/ces_standard/interfaces/innerkits/native/include", + "//base/security/deviceauth/interfaces/innerkits", + "//base/startup/syspara_lite/interfaces/kits", + "//base/startup/syspara_lite/adapter/native/syspara/include", ] sources = [ @@ -60,6 +69,7 @@ if (defined(ohos_lite)) { "device_profile_core:distributed_device_profile_client", "hiviewdfx_hilog_native:libhilog", "ipc:ipc_core", + "dsoftbus_standard:softbus_client" ] defines = [ diff --git a/interfaces/kits/js/src/native_devicemanager_js.cpp b/interfaces/kits/js/src/native_devicemanager_js.cpp index bb96c37a7044c5a55a282bc3077f4f9ed3ee30f6..5823b97d6a1792280afc11dfe5a2b3825e1a6f65 100644 --- a/interfaces/kits/js/src/native_devicemanager_js.cpp +++ b/interfaces/kits/js/src/native_devicemanager_js.cpp @@ -1491,8 +1491,8 @@ napi_value DeviceManagerNapi::AuthenticateDevice(napi_env env, napi_callback_inf JsToDmDeviceInfo(env, argv[0], deviceInfo); std::string extraString; JsToDmExtra(env, argv[PARAM_INDEX_ONE], extraString, authAsyncCallbackInfo_.authType); - int32_t ret = DeviceManager::GetInstance().AuthenticateDevice(deviceManagerWrapper->bundleName_, 1, deviceInfo, - extraString, authCallback); + int32_t ret = DeviceManager::GetInstance().AuthenticateDevice(deviceManagerWrapper->bundleName_, + authAsyncCallbackInfo_.authType, deviceInfo, extraString, authCallback); if (ret != 0) { LOGE("AuthenticateDevice for bundleName %s failed, ret %d", deviceManagerWrapper->bundleName_.c_str(), ret); } diff --git a/services/devicemanagerservice/include/authentication/authentication.h b/services/devicemanagerservice/include/authentication/authentication.h index 67ca0c3ee86b1e0fccae4eb20927cda40dc3a829..7c59f31c49fe03087aa33a5f99a1ab6663f45866 100644 --- a/services/devicemanagerservice/include/authentication/authentication.h +++ b/services/devicemanagerservice/include/authentication/authentication.h @@ -24,9 +24,9 @@ class DmAuthManager; class IAuthentication { public: virtual ~IAuthentication() = default; - virtual int32_t ShowAuthInfo(int32_t code, std::shared_ptr authManager) = 0; - virtual int32_t StartAuth(int32_t code, std::shared_ptr authManager) = 0; - virtual int32_t VerifyAuthentication(std::string pinToken, int32_t code, const std::string &authParam) = 0; + virtual int32_t ShowAuthInfo(std::string &authToken, std::shared_ptr authManager) = 0; + virtual int32_t StartAuth(std::string &authToken, std::shared_ptr authManager) = 0; + virtual int32_t VerifyAuthentication(std::string &authToken, const std::string &authParam) = 0; }; using CreateIAuthAdapterFuncPtr = IAuthentication *(*)(void); diff --git a/services/devicemanagerservice/include/authentication/dm_auth_manager.h b/services/devicemanagerservice/include/authentication/dm_auth_manager.h index 6a7ae6b85aeb7a5a7f90f58e97bf559765801835..204ef0fe7eeec2ac1a40d9fdd25aa51eff6c8f3f 100644 --- a/services/devicemanagerservice/include/authentication/dm_auth_manager.h +++ b/services/devicemanagerservice/include/authentication/dm_auth_manager.h @@ -86,7 +86,6 @@ typedef struct DmAuthRequestContext { std::string appThumbnail; std::string token; int32_t reason; - int32_t aceId; std::vector syncGroupList; } DmAuthRequestContext; @@ -110,10 +109,11 @@ typedef struct DmAuthResponseContext { std::string appIcon; std::string appThumbnail; std::string token; + std::string authToken; + int32_t pageId; int64_t requestId; int32_t code; int32_t state; - int32_t aceId; std::vector syncGroupList; } DmAuthResponseContext; @@ -131,7 +131,6 @@ public: const std::string &extra); int32_t UnAuthenticateDevice(const std::string &pkgName, const std::string &deviceId); int32_t VerifyAuthentication(const std::string &authParam); - void VerifyPinAuthAuthentication(const std::string &action); void OnSessionOpened(int32_t sessionId, int32_t sessionSide, int32_t result); void OnSessionClosed(int32_t sessionId); void OnDataReceived(int32_t sessionId, std::string message); @@ -164,7 +163,7 @@ public: int32_t GetAuthenticationParam(DmAuthParam &authParam); int32_t OnUserOperation(int32_t action); void UserSwitchEventCallback(int32_t userId); - void ClosePage(const int32_t &id); + int32_t SetPageId(int32_t pageId); private: std::shared_ptr softbusConnector_; diff --git a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp index 9ba556f4a188c3e4bf57fd6ff8f48da531b2ad7a..6bbf020e95ff38c695e9a8c76925a7127910596a 100644 --- a/services/devicemanagerservice/src/authentication/auth_message_processor.cpp +++ b/services/devicemanagerservice/src/authentication/auth_message_processor.cpp @@ -128,9 +128,6 @@ void AuthMessageProcessor::CreateResponseAuthMessage(nlohmann::json &json) json[TAG_REPLY] = authResponseContext_->reply; json[TAG_DEVICE_ID] = authResponseContext_->deviceId; json[TAG_TOKEN] = authResponseContext_->token; - // json[TAG_GROUPIDS] = authResponseContext_->deviceId; //? - LOGI("AuthMessageProcessor::ParseAuthResponseMessage %d,%d", authResponseContext_->reply, - authResponseContext_->code); LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s", authResponseContext_->deviceId.c_str()); if (authResponseContext_->reply == 0) { std::string groupId = authResponseContext_->groupId; @@ -141,11 +138,11 @@ void AuthMessageProcessor::CreateResponseAuthMessage(nlohmann::json &json) return; } groupId = jsonObject[TAG_GROUP_ID]; - json[PIN_CODE_KEY] = authResponseContext_->code; json[TAG_NET_ID] = authResponseContext_->networkId; json[TAG_REQUEST_ID] = authResponseContext_->requestId; json[TAG_GROUP_ID] = groupId; json[TAG_GROUP_NAME] = authResponseContext_->groupName; + json[TAG_AUTH_TOKEN] = authResponseContext_->authToken; LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", groupId.c_str(), authResponseContext_->groupName.c_str()); } @@ -220,11 +217,11 @@ void AuthMessageProcessor::ParseAuthResponseMessage(nlohmann::json &json) authResponseContext_->deviceId = json[TAG_DEVICE_ID]; authResponseContext_->token = json[TAG_TOKEN]; if (authResponseContext_->reply == 0) { - authResponseContext_->code = json[PIN_CODE_KEY]; authResponseContext_->networkId = json[TAG_NET_ID]; authResponseContext_->requestId = json[TAG_REQUEST_ID]; authResponseContext_->groupId = json[TAG_GROUP_ID]; authResponseContext_->groupName = json[TAG_GROUP_NAME]; + authResponseContext_->authToken = json[TAG_AUTH_TOKEN]; LOGI("AuthMessageProcessor::ParseAuthResponseMessage %s,%s", authResponseContext_->groupId.c_str(), authResponseContext_->groupName.c_str()); } diff --git a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp index de210e85d6399e8e313c24fdea4ea7ff03a6d014..be0bec9b4d9870f77977e9cea993627892f579f9 100644 --- a/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp +++ b/services/devicemanagerservice/src/authentication/dm_auth_manager.cpp @@ -80,7 +80,7 @@ DmAuthManager::~DmAuthManager() int32_t DmAuthManager::AuthenticateDevice(const std::string &pkgName, int32_t authType, const std::string &deviceId, const std::string &extra) { - LOGE("DmAuthManager::AuthenticateDevice start"); + LOGE("DmAuthManager::AuthenticateDevice start auth type %d", authType); std::shared_ptr authentication = authenticationMap_[authType]; if (authentication == nullptr) { LOGE("DmAuthManager::AuthenticateDevice authType %d not support.", authType); @@ -178,12 +178,13 @@ int32_t DmAuthManager::VerifyAuthentication(const std::string &authParam) timerMap_[INPUT_TIMEOUT_TASK]->Stop(SESSION_CANCEL_TIMEOUT); std::shared_ptr ptr; - if (authenticationMap_.find(1) == authenticationMap_.end()) { + if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) { LOGE("DmAuthManager::authenticationMap_ is null"); return DM_FAILED; } - ptr = authenticationMap_[1]; - int32_t ret = ptr->VerifyAuthentication(authRequestContext_->token, authResponseContext_->code, authParam); + + ptr = authenticationMap_[authResponseContext_->authType]; + int32_t ret = ptr->VerifyAuthentication(authResponseContext_->authToken, authParam); switch (ret) { case DM_OK: authRequestState_->TransitionTo(std::make_shared()); @@ -193,7 +194,6 @@ int32_t DmAuthManager::VerifyAuthentication(const std::string &authParam) DM_AUTH_INPUT_FAILED, ""); break; default: - CancelDisplay(); authRequestContext_->reason = DM_AUTH_INPUT_FAILED; authResponseContext_->state = authRequestState_->GetStateType(); authRequestState_->TransitionTo(std::make_shared()); @@ -304,6 +304,7 @@ void DmAuthManager::OnDataReceived(int32_t sessionId, std::string message) authResponseState_->TransitionTo(std::make_shared()); } else if (authRequestState_ != nullptr && authRequestState_->GetStateType() != AuthState::AUTH_REQUEST_FINISH) { + authResponseContext_->state = authRequestState_->GetStateType(); authRequestState_->TransitionTo(std::make_shared()); } break; @@ -326,7 +327,13 @@ void DmAuthManager::OnGroupCreated(int64_t requestId, const std::string &groupId softbusConnector_->GetSoftbusSession()->SendData(authResponseContext_->sessionId, message); return; } - authResponseContext_->code = GeneratePincode(); + nlohmann::json jsonObj; + jsonObj[PIN_CODE_KEY] = GeneratePincode(); + jsonObj[PIN_TOKEN] = authResponseContext_->token; + jsonObj[QR_CODE_KEY] = GenerateGroupName(); + jsonObj[NFC_CODE_KEY] = GenerateGroupName(); + authResponseContext_->authToken = jsonObj.dump(); + LOGI("DmAuthManager::AddMember start %s",authResponseContext_->authToken.c_str()); authResponseContext_->groupId = groupId; authMessageProcessor_->SetResponseContext(authResponseContext_); std::string message = authMessageProcessor_->CreateSimpleMessage(MSG_TYPE_RESP_AUTH); @@ -505,10 +512,16 @@ int32_t DmAuthManager::CreateGroup() int32_t DmAuthManager::AddMember(const std::string &deviceId) { LOGI("DmAuthManager::AddMember start"); + nlohmann::json jsonObj = nlohmann::json::parse(authResponseContext_->authToken, nullptr, false); + if (jsonObj.is_discarded()) { + LOGE("DecodeRequestAuth jsonStr error"); + return DM_FAILED; + } + LOGI("DmAuthManager::AddMember start %s",authResponseContext_->authToken.c_str()); nlohmann::json jsonObject; jsonObject[TAG_GROUP_ID] = authResponseContext_->groupId; jsonObject[TAG_GROUP_NAME] = authResponseContext_->groupName; - jsonObject[PIN_CODE_KEY] = authResponseContext_->code; + jsonObject[PIN_CODE_KEY] = jsonObj[PIN_CODE_KEY]; jsonObject[TAG_REQUEST_ID] = authResponseContext_->requestId; jsonObject[TAG_DEVICE_ID] = authResponseContext_->deviceId; std::string connectInfo = jsonObject.dump(); @@ -520,7 +533,7 @@ int32_t DmAuthManager::AddMember(const std::string &deviceId) return DM_FAILED; } LOGI("DmAuthManager::authRequestContext CancelDisplay start"); - Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId); return DM_OK; } @@ -547,7 +560,13 @@ void DmAuthManager::AuthenticateFinish() LOGI("DmAuthManager::AuthenticateFinish start"); if (authResponseState_ != nullptr) { if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_FINISH) { - Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId); + } + if (authResponseState_->GetStateType() == AuthState::AUTH_RESPONSE_SHOW + && authResponseContext_->authType != 1) { + authMessageProcessor_->SetResponseContext(authResponseContext_); + std::string message = authMessageProcessor_->CreateSimpleMessage(MSG_TYPE_REQ_AUTH_TERMINATE); + softbusConnector_->GetSoftbusSession()->SendData(authResponseContext_->sessionId, message); } if (!timerMap_.empty()) { for (auto &iter : timerMap_) { @@ -569,7 +588,7 @@ void DmAuthManager::AuthenticateFinish() } if (authResponseContext_->state == AuthState::AUTH_REQUEST_INPUT) { - Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->aceId); + Ace::UIServiceMgrClient::GetInstance()->CancelDialog(authResponseContext_->pageId); } listener_->OnAuthResult(authRequestContext_->hostPkgName, authRequestContext_->deviceId, @@ -650,7 +669,12 @@ int32_t DmAuthManager::SetAuthResponseState(std::shared_ptr a int32_t DmAuthManager::GetPinCode() { - return authResponseContext_->code; + nlohmann::json jsonObj = nlohmann::json::parse(authResponseContext_->authToken, nullptr, false); + if (jsonObj.is_discarded()) { + LOGE("DecodeRequestAuth jsonStr error"); + return DM_FAILED; + } + return jsonObj[PIN_CODE_KEY]; } void DmAuthManager::ShowConfigDialog() @@ -681,25 +705,25 @@ void DmAuthManager::ShowAuthInfoDialog() { LOGI("DmAuthManager::ShowAuthInfoDialog start"); std::shared_ptr ptr; - if (authenticationMap_.find(1) == authenticationMap_.end()) { + if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) { LOGE("DmAuthManager::authenticationMap_ is null"); return; } - ptr = authenticationMap_[1]; - LOGI("ShowAuthInfoDialog code:%d", authResponseContext_->code); - ptr->ShowAuthInfo(authResponseContext_->code, shared_from_this()); + ptr = authenticationMap_[authResponseContext_->authType]; + LOGI("ShowAuthInfoDialog authToken:%s", authResponseContext_->authToken.c_str()); + ptr->ShowAuthInfo(authResponseContext_->authToken, shared_from_this()); } void DmAuthManager::ShowStartAuthDialog() { LOGI("DmAuthManager::ShowStartAuthDialog start"); std::shared_ptr ptr; - if (authenticationMap_.find(1) == authenticationMap_.end()) { + if (authenticationMap_.find(authResponseContext_->authType) == authenticationMap_.end()) { LOGE("DmAuthManager::authenticationMap_ is null"); return; } - ptr = authenticationMap_[1]; - ptr->StartAuth(authResponseContext_->code, shared_from_this()); + ptr = authenticationMap_[authResponseContext_->authType]; + ptr->StartAuth(authResponseContext_->authToken, shared_from_this()); } int32_t DmAuthManager::GetAuthenticationParam(DmAuthParam &authParam) @@ -784,24 +808,10 @@ void DmAuthManager::UserSwitchEventCallback (int32_t userId) } } -void DmAuthManager::VerifyPinAuthAuthentication(const std::string &action) +int32_t DmAuthManager::SetPageId(int32_t pageId) { - LOGI("DmAuthManager::VerifyPinAuthAuthentication"); - timerMap_[INPUT_TIMEOUT_TASK]->Stop(SESSION_CANCEL_TIMEOUT); - if (action == "0") { - authRequestState_->TransitionTo(std::make_shared()); - } - if (action == "1") { - authRequestContext_->reason = DM_AUTH_INPUT_FAILED; - authResponseContext_->state = authRequestState_->GetStateType(); - authRequestState_->TransitionTo(std::make_shared()); - } - LOGI("DmAuthManager::VerifyAuthentication complete"); -} - -void DmAuthManager::ClosePage(const int32_t &id) -{ - authResponseContext_->aceId = id; + authResponseContext_->pageId = pageId; + return DM_OK; } } // namespace DistributedHardware } // namespace OHOS