diff --git a/interfaces/innerkits/accesstoken/test/unittest/src/accesstoken_kit_test.cpp b/interfaces/innerkits/accesstoken/test/unittest/src/accesstoken_kit_test.cpp index cd314d88bee2341b1b468fb55e8abeb6f448509d..52bdfd5046d8df8fb05d9a58f1644f7689735509 100644 --- a/interfaces/innerkits/accesstoken/test/unittest/src/accesstoken_kit_test.cpp +++ b/interfaces/innerkits/accesstoken/test/unittest/src/accesstoken_kit_test.cpp @@ -223,6 +223,32 @@ PermissionStateFull g_locationTestStateAccurate12 = { }; } +void NativeTokenGet() +{ + uint64_t tokenId; + const char **perms = new const char *[4]; + perms[0] = "ohos.permission.DISTRIBUTED_DATASYNC"; + perms[1] = "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"; + perms[2] = "ohos.permission.REVOKE_SENSITIVE_PERMISSIONS"; + perms[3] = "ohos.permission.GET_SENSITIVE_PERMISSIONS"; + + NativeTokenInfoParams infoInstance = { + .dcapsNum = 0, + .permsNum = 4, + .aclsNum = 0, + .dcaps = nullptr, + .perms = perms, + .acls = nullptr, + .aplStr = "system_core", + }; + + infoInstance.processName = "TestCase"; + tokenId = GetAccessTokenId(&infoInstance); + SetSelfTokenID(tokenId); + AccessTokenKit::ReloadNativeTokenInfo(); + delete[] perms; +} + void AccessTokenKitTest::SetUpTestCase() { // make test case clean @@ -233,6 +259,8 @@ void AccessTokenKitTest::SetUpTestCase() tokenID = AccessTokenKit::GetHapTokenID(TEST_USER_ID, TEST_BUNDLE_NAME, 0); AccessTokenKit::DeleteToken(tokenID); + + NativeTokenGet(); } void AccessTokenKitTest::TearDownTestCase() diff --git a/services/accesstokenmanager/main/cpp/include/service/accesstoken_manager_stub.h b/services/accesstokenmanager/main/cpp/include/service/accesstoken_manager_stub.h index 6fb115250644bf122d75fb13971fc53f09643fb6..98cbf7e3440f25bb9e0f1bd404db2c73df6eac93 100644 --- a/services/accesstokenmanager/main/cpp/include/service/accesstoken_manager_stub.h +++ b/services/accesstokenmanager/main/cpp/include/service/accesstoken_manager_stub.h @@ -72,12 +72,15 @@ private: void DumpTokenInfoInner(MessageParcel& data, MessageParcel& reply); bool IsAuthorizedCalling() const; - bool IsAccessTokenCalling() const; + bool IsAccessTokenCalling(); bool IsNativeProcessCalling(); + bool IsFoundationCalling() const; static const int32_t SYSTEM_UID = 1000; static const int32_t ROOT_UID = 0; static const int32_t ACCESSTOKEN_UID = 3020; + AccessTokenID tokenSyncId_ = 0; + using RequestFuncType = void (AccessTokenManagerStub::*)(MessageParcel &data, MessageParcel &reply); std::map requestFuncMap_; }; diff --git a/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_stub.cpp b/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_stub.cpp index a678b578255ba731b6b6b74bd32be09edbd9e9d6..f32db8c38de7246ec9667ad47a55346d408f0e16 100644 --- a/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_stub.cpp +++ b/services/accesstokenmanager/main/cpp/src/service/accesstoken_manager_stub.cpp @@ -59,7 +59,7 @@ int32_t AccessTokenManagerStub::OnRemoteRequest( void AccessTokenManagerStub::DeleteTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling()) { + if (!IsFoundationCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_INFO(LABEL, "permission denied"); reply.WriteInt32(RET_FAILED); return; @@ -202,6 +202,16 @@ void AccessTokenManagerStub::RevokePermissionInner(MessageParcel& data, MessageP void AccessTokenManagerStub::ClearUserGrantedPermissionStateInner(MessageParcel& data, MessageParcel& reply) { + uint32_t callingTokenID = IPCSkeleton::GetCallingTokenID(); + if (!IsAuthorizedCalling() && + VerifyAccessToken(callingTokenID, REVOKE_SENSITIVE_PERMISSIONS) == PERMISSION_DENIED) { + HiviewDFX::HiSysEvent::Write(HiviewDFX::HiSysEvent::Domain::ACCESS_TOKEN, "PERMISSION_VERIFY_REPORT", + HiviewDFX::HiSysEvent::EventType::SECURITY, "CODE", VERIFY_PERMISSION_ERROR, + "CALLER_TOKENID", callingTokenID); + ACCESSTOKEN_LOG_ERROR(LABEL, "permission denied(tokenID=%{public}d)", callingTokenID); + reply.WriteInt32(RET_FAILED); + return; + } AccessTokenID tokenID = data.ReadUint32(); int result = this->ClearUserGrantedPermissionState(tokenID); reply.WriteInt32(result); @@ -210,7 +220,7 @@ void AccessTokenManagerStub::ClearUserGrantedPermissionStateInner(MessageParcel& void AccessTokenManagerStub::AllocHapTokenInner(MessageParcel& data, MessageParcel& reply) { AccessTokenIDEx res = {0}; - if (!IsAuthorizedCalling()) { + if (!IsFoundationCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -236,7 +246,7 @@ void AccessTokenManagerStub::GetTokenTypeInner(MessageParcel& data, MessageParce void AccessTokenManagerStub::CheckNativeDCapInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -249,7 +259,7 @@ void AccessTokenManagerStub::CheckNativeDCapInner(MessageParcel& data, MessagePa void AccessTokenManagerStub::GetHapTokenIDInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(INVALID_TOKENID); return; @@ -263,7 +273,7 @@ void AccessTokenManagerStub::GetHapTokenIDInner(MessageParcel& data, MessageParc void AccessTokenManagerStub::AllocLocalTokenIDInner(MessageParcel& data, MessageParcel& reply) { - if ((!IsAuthorizedCalling()) && (!IsNativeProcessCalling())) { + if ((!IsNativeProcessCalling()) && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(INVALID_TOKENID); return; @@ -276,7 +286,7 @@ void AccessTokenManagerStub::AllocLocalTokenIDInner(MessageParcel& data, Message void AccessTokenManagerStub::UpdateHapTokenInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling()) { + if (!IsFoundationCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -296,7 +306,7 @@ void AccessTokenManagerStub::UpdateHapTokenInner(MessageParcel& data, MessagePar void AccessTokenManagerStub::GetHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -310,7 +320,7 @@ void AccessTokenManagerStub::GetHapTokenInfoInner(MessageParcel& data, MessagePa void AccessTokenManagerStub::GetNativeTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -325,8 +335,7 @@ void AccessTokenManagerStub::GetNativeTokenInfoInner(MessageParcel& data, Messag void AccessTokenManagerStub::RegisterPermStateChangeCallbackInner(MessageParcel& data, MessageParcel& reply) { uint32_t callingTokenID = IPCSkeleton::GetCallingTokenID(); - if (!IsAuthorizedCalling() && - VerifyAccessToken(callingTokenID, GET_SENSITIVE_PERMISSIONS) == PERMISSION_DENIED) { + if (VerifyAccessToken(callingTokenID, GET_SENSITIVE_PERMISSIONS) == PERMISSION_DENIED) { ACCESSTOKEN_LOG_ERROR(LABEL, "permission denied(tokenID=%{public}d)", callingTokenID); reply.WriteInt32(RET_FAILED); return; @@ -349,8 +358,7 @@ void AccessTokenManagerStub::RegisterPermStateChangeCallbackInner(MessageParcel& void AccessTokenManagerStub::UnRegisterPermStateChangeCallbackInner(MessageParcel& data, MessageParcel& reply) { uint32_t callingTokenID = IPCSkeleton::GetCallingTokenID(); - if (!IsAuthorizedCalling() && - VerifyAccessToken(callingTokenID, GET_SENSITIVE_PERMISSIONS) == PERMISSION_DENIED) { + if (VerifyAccessToken(callingTokenID, GET_SENSITIVE_PERMISSIONS) == PERMISSION_DENIED) { ACCESSTOKEN_LOG_ERROR(LABEL, "permission denied(tokenID=%{public}d)", callingTokenID); reply.WriteInt32(RET_FAILED); return; @@ -367,13 +375,18 @@ void AccessTokenManagerStub::UnRegisterPermStateChangeCallbackInner(MessageParce void AccessTokenManagerStub::ReloadNativeTokenInfoInner(MessageParcel& data, MessageParcel& reply) { + if (!IsAuthorizedCalling()) { + ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); + reply.WriteUint32(RET_FAILED); + return; + } int32_t result = this->ReloadNativeTokenInfo(); reply.WriteInt32(result); } void AccessTokenManagerStub::GetNativeTokenIdInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteUint32(INVALID_TOKENID); return; @@ -390,7 +403,7 @@ void AccessTokenManagerStub::GetNativeTokenIdInner(MessageParcel& data, MessageP #ifdef TOKEN_SYNC_ENABLE void AccessTokenManagerStub::GetHapTokenInfoFromRemoteInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -405,7 +418,7 @@ void AccessTokenManagerStub::GetHapTokenInfoFromRemoteInner(MessageParcel& data, void AccessTokenManagerStub::GetAllNativeTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -421,7 +434,7 @@ void AccessTokenManagerStub::GetAllNativeTokenInfoInner(MessageParcel& data, Mes void AccessTokenManagerStub::SetRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -439,7 +452,7 @@ void AccessTokenManagerStub::SetRemoteHapTokenInfoInner(MessageParcel& data, Mes void AccessTokenManagerStub::SetRemoteNativeTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -469,7 +482,7 @@ void AccessTokenManagerStub::SetRemoteNativeTokenInfoInner(MessageParcel& data, void AccessTokenManagerStub::DeleteRemoteTokenInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -483,7 +496,7 @@ void AccessTokenManagerStub::DeleteRemoteTokenInner(MessageParcel& data, Message void AccessTokenManagerStub::GetRemoteNativeTokenIDInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(INVALID_TOKENID); return; @@ -497,7 +510,7 @@ void AccessTokenManagerStub::GetRemoteNativeTokenIDInner(MessageParcel& data, Me void AccessTokenManagerStub::DeleteRemoteDeviceTokensInner(MessageParcel& data, MessageParcel& reply) { - if (!IsAuthorizedCalling() && !IsAccessTokenCalling()) { + if (!IsAccessTokenCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -511,7 +524,7 @@ void AccessTokenManagerStub::DeleteRemoteDeviceTokensInner(MessageParcel& data, void AccessTokenManagerStub::DumpTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - if (!IsNativeProcessCalling()) { + if (!IsNativeProcessCalling() && !IsAuthorizedCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; @@ -524,26 +537,31 @@ void AccessTokenManagerStub::DumpTokenInfoInner(MessageParcel& data, MessageParc bool AccessTokenManagerStub::IsAuthorizedCalling() const { - int callingUid = IPCSkeleton::GetCallingUid(); + int32_t callingUid = IPCSkeleton::GetCallingUid(); ACCESSTOKEN_LOG_INFO(LABEL, "Calling uid: %{public}d", callingUid); - return callingUid == SYSTEM_UID || callingUid == ROOT_UID || callingUid == FOUNDATION_UID; + return callingUid == SYSTEM_UID || callingUid == ROOT_UID; } -bool AccessTokenManagerStub::IsAccessTokenCalling() const +bool AccessTokenManagerStub::IsFoundationCalling() const { - int callingUid = IPCSkeleton::GetCallingUid(); - return callingUid == ACCESSTOKEN_UID; + int32_t callingUid = IPCSkeleton::GetCallingUid(); + ACCESSTOKEN_LOG_INFO(LABEL, "Calling uid: %{public}d", callingUid); + return callingUid == FOUNDATION_UID; +} + +bool AccessTokenManagerStub::IsAccessTokenCalling() +{ + int tokenCaller = IPCSkeleton::GetCallingTokenID(); + if (tokenSyncId_ == 0) { + tokenSyncId_ = this->GetNativeTokenId("token_sync_service"); + } + return tokenCaller == tokenSyncId_; } bool AccessTokenManagerStub::IsNativeProcessCalling() { AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); - int32_t type = this->GetTokenType(tokenCaller); - ACCESSTOKEN_LOG_DEBUG(LABEL, "Calling tokenID: %{public}d, type: %{public}d", tokenCaller, type); - if ((type != TOKEN_NATIVE) && (type != TOKEN_SHELL)) { - return false; - } - return true; + return this->GetTokenType(tokenCaller) == TOKEN_NATIVE; } AccessTokenManagerStub::AccessTokenManagerStub() diff --git a/services/tokensyncmanager/include/service/token_sync_manager_stub.h b/services/tokensyncmanager/include/service/token_sync_manager_stub.h index f16fd8dd75dab71eb574b3e398940996b1364e5f..ed587de81780c9fcac8a82beb0c8c92747c9bd6f 100644 --- a/services/tokensyncmanager/include/service/token_sync_manager_stub.h +++ b/services/tokensyncmanager/include/service/token_sync_manager_stub.h @@ -34,6 +34,9 @@ private: void GetRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply); void DeleteRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply); void UpdateRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply); + + bool IsNativeProcessCalling() const; + bool IsRootCalling() const; }; } // namespace AccessToken } // namespace Security diff --git a/services/tokensyncmanager/src/service/token_sync_manager_stub.cpp b/services/tokensyncmanager/src/service/token_sync_manager_stub.cpp index 85ca0d399374195c7c6281a960d0a9e91a7f9001..73cac050367bb4791f820b2e62e04e96a17d509a 100644 --- a/services/tokensyncmanager/src/service/token_sync_manager_stub.cpp +++ b/services/tokensyncmanager/src/service/token_sync_manager_stub.cpp @@ -26,6 +26,7 @@ namespace Security { namespace AccessToken { namespace { static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN_ACCESSTOKEN, "TokenSyncManagerStub"}; +static const int32_t ROOT_UID = 0; } int32_t TokenSyncManagerStub::OnRemoteRequest( @@ -53,15 +54,29 @@ int32_t TokenSyncManagerStub::OnRemoteRequest( return NO_ERROR; } -void TokenSyncManagerStub::GetRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) +bool TokenSyncManagerStub::IsNativeProcessCalling() const { AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); int type = (reinterpret_cast(&tokenCaller))->type; - if ((type != TOKEN_NATIVE) && (type != TOKEN_SHELL)) { + ACCESSTOKEN_LOG_DEBUG(LABEL, "Calling type: %{public}d", type); + return type == TOKEN_NATIVE; +} + +bool TokenSyncManagerStub::IsRootCalling() const +{ + int callingUid = IPCSkeleton::GetCallingUid(); + ACCESSTOKEN_LOG_DEBUG(LABEL, "Calling uid: %{public}d", callingUid); + return callingUid == ROOT_UID; +} + +void TokenSyncManagerStub::GetRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) +{ + if (!IsRootCalling() && !IsNativeProcessCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; } + std::string deviceID = data.ReadString(); AccessTokenID tokenID = data.ReadUint32(); @@ -72,13 +87,12 @@ void TokenSyncManagerStub::GetRemoteHapTokenInfoInner(MessageParcel& data, Messa void TokenSyncManagerStub::DeleteRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); - int type = (reinterpret_cast(&tokenCaller))->type; - if ((type != TOKEN_NATIVE) && (type != TOKEN_SHELL)) { + if (!IsRootCalling() && !IsNativeProcessCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; } + std::string deviceID = data.ReadString(); AccessTokenID tokenID = data.ReadUint32(); int result = this->DeleteRemoteHapTokenInfo(tokenID); @@ -87,13 +101,12 @@ void TokenSyncManagerStub::DeleteRemoteHapTokenInfoInner(MessageParcel& data, Me void TokenSyncManagerStub::UpdateRemoteHapTokenInfoInner(MessageParcel& data, MessageParcel& reply) { - AccessTokenID tokenCaller = IPCSkeleton::GetCallingTokenID(); - int type = (reinterpret_cast(&tokenCaller))->type; - if ((type != TOKEN_NATIVE) && (type != TOKEN_SHELL)) { + if (!IsRootCalling() && !IsNativeProcessCalling()) { ACCESSTOKEN_LOG_ERROR(LABEL, "%{public}s called, permission denied", __func__); reply.WriteInt32(RET_FAILED); return; } + sptr tokenInfoParcelPtr = data.ReadParcelable(); int result = RET_FAILED; if (tokenInfoParcelPtr != nullptr) { diff --git a/services/tokensyncmanager/test/unittest/token_sync_service/BUILD.gn b/services/tokensyncmanager/test/unittest/token_sync_service/BUILD.gn index 9252861a63927f9713e3c454cf970d59e5631982..0fae85acec039b32225e2c48d5dfddfdbcc59cc3 100644 --- a/services/tokensyncmanager/test/unittest/token_sync_service/BUILD.gn +++ b/services/tokensyncmanager/test/unittest/token_sync_service/BUILD.gn @@ -67,12 +67,14 @@ ohos_unittest("libtoken_sync_service_sdk_test") { "//foundation/communication/dsoftbus/interfaces/kits/common", "//foundation/communication/dsoftbus/interfaces/kits/bus_center", "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp/include", + "//base/security/access_token/interfaces/innerkits/token_setproc/include", ] deps = [ "//base/security/access_token/frameworks/accesstoken:accesstoken_communication_adapter_cxx", "//base/security/access_token/frameworks/common:accesstoken_common_cxx", "//base/security/access_token/interfaces/innerkits/accesstoken:libaccesstoken_sdk", + "//base/security/access_token/interfaces/innerkits/token_setproc:libtoken_setproc", "//foundation/distributedhardware/device_manager/interfaces/inner_kits/native_cpp:devicemanagersdk", "//third_party/zlib:libz", ] diff --git a/services/tokensyncmanager/test/unittest/token_sync_service/token_sync_service_test.cpp b/services/tokensyncmanager/test/unittest/token_sync_service/token_sync_service_test.cpp index 3517a2721d6ae47e051803ce0f480aa41f2233f7..a5adc86de94257ade4d609590401f3ab0118ddad 100644 --- a/services/tokensyncmanager/test/unittest/token_sync_service/token_sync_service_test.cpp +++ b/services/tokensyncmanager/test/unittest/token_sync_service/token_sync_service_test.cpp @@ -32,6 +32,7 @@ #include "device_info.h" #include "soft_bus_device_connection_listener.h" #include "soft_bus_session_listener.h" +#include "token_setproc.h" #include "device_info_manager.h" #define private public @@ -63,8 +64,19 @@ TokenSyncServiceTest::TokenSyncServiceTest() } TokenSyncServiceTest::~TokenSyncServiceTest() {} + +void NativeTokenGet() +{ + uint64_t tokenId; + tokenId = AccessTokenKit::GetNativeTokenId("token_sync_service"); + ASSERT_NE(tokenId, 0); + SetSelfTokenID(tokenId); +} + void TokenSyncServiceTest::SetUpTestCase() -{} +{ + NativeTokenGet(); +} void TokenSyncServiceTest::TearDownTestCase() {} void TokenSyncServiceTest::SetUp()