diff --git a/services/implementation/include/authentication_v2/auth_manager.h b/services/implementation/include/authentication_v2/auth_manager.h index 02deef3fe7ca1f8f8b1fec0005eccb180e1578b2..604c5ea7e54b981e0faf3bbddd3d895d85040d8e 100644 --- a/services/implementation/include/authentication_v2/auth_manager.h +++ b/services/implementation/include/authentication_v2/auth_manager.h @@ -154,6 +154,7 @@ private: void GetBindCallerInfo(); int32_t GetBindLevel(int32_t bindLevel); void GetIsNeedJoinLnnParam(const std::map &bindParam); + void GetConnDelayCloseTime(const std::string &extra); }; class AuthSrcManager : public AuthManager { diff --git a/services/implementation/src/authentication_v2/auth_manager.cpp b/services/implementation/src/authentication_v2/auth_manager.cpp index a6ddbde19410683217701c0d08f81c9b3751e9ca..786210c80e6768160413d1596241b1e66c2162c3 100644 --- a/services/implementation/src/authentication_v2/auth_manager.cpp +++ b/services/implementation/src/authentication_v2/auth_manager.cpp @@ -638,12 +638,15 @@ int32_t AuthManager::AuthenticateDevice(const std::string &pkgName, int32_t auth } context_->isAuthenticateDevice = true; if (authType == AUTH_TYPE_CRE) { + GetConnDelayCloseTime(extra); LOGI("AuthManager::AuthenticateDevice for credential type, joinLNN directly."); context_->softbusConnector->JoinLnn(deviceId, true); context_->listener->OnAuthResult(context_->processInfo, context_->peerTargetId.deviceId, "", STATUS_DM_AUTH_DEFAULT, DM_OK); context_->listener->OnBindResult(context_->processInfo, context_->peerTargetId, DM_OK, STATUS_DM_AUTH_DEFAULT, ""); + context_->reason = DM_OK; + context_->authStateMachine->TransitionTo(std::make_shared()); return DM_OK; } InitAuthState(pkgName, authType, deviceId, extra); @@ -653,6 +656,21 @@ int32_t AuthManager::AuthenticateDevice(const std::string &pkgName, int32_t auth return DM_OK; } +void AuthManager::GetConnDelayCloseTime(const std::string &extra) +{ + JsonObject jsonObject(extra); + if (jsonObject.IsDiscarded()) { + LOGE("extra string not a json type."); + return; + } + CHECK_NULL_VOID(context_); + context_->connDelayCloseTime = 0; + if (IsString(jsonObject, PARAM_CLOSE_SESSION_DELAY_SECONDS)) { + std::string delaySecondsStr = jsonObject[PARAM_CLOSE_SESSION_DELAY_SECONDS].Get(); + context_->connDelayCloseTime = GetCloseSessionDelaySeconds(delaySecondsStr); + } +} + int32_t AuthManager::BindTarget(const std::string &pkgName, const PeerTargetId &targetId, const std::map &bindParam, int sessionId, uint64_t logicalSessionId) {