diff --git a/services/accesstoken/BUILD.gn b/services/accesstoken/BUILD.gn deleted file mode 100644 index a58bc6e088e1356b89ac291c459b351fb5ff70c5..0000000000000000000000000000000000000000 --- a/services/accesstoken/BUILD.gn +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos.gni") - -ohos_shared_library("accesstoken_manager_service") { - subsystem_name = "security" - part_name = "access_token" - - include_dirs = [ - "main/cpp/include", - "//utils/system/safwk/native/include", - "//base/security/access_token/frameworks/accesstoken", - "//base/security/access_token/interfaces/innerkits/accesstoken//main/cpp/include", - ] - - sources = [ - "main/cpp/src/accesstoken_manager_service.cpp", - "main/cpp/src/accesstoken_manager_stub.cpp", - ] - - cflags_cc = [ "-DHILOG_ENABLE" ] - - deps = [ - "//utils/native/base:utils", - ] - - external_deps = [ - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_standard:samgr_proxy", - ] -} diff --git a/services/accesstoken/main/cpp/include/accesstoken_manager_service.h b/services/accesstoken/main/cpp/include/accesstoken_manager_service.h deleted file mode 100644 index 8174ae72f6a7f3a6dd727d32afe011a88beb45d6..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/cpp/include/accesstoken_manager_service.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ACCESSTOKEN_MANAGER_SERVICE_H -#define ACCESSTOKEN_MANAGER_SERVICE_H - -#include "accesstoken_manager_stub.h" -#include "singleton.h" -#include "iremote_object.h" -#include "system_ability.h" -#include "nocopyable.h" - -namespace OHOS { -namespace Security { -namespace AccessToken { -enum class ServiceRunningState { STATE_NOT_START, STATE_RUNNING }; -class AccessTokenManagerService final : public SystemAbility, public AccessTokenManagerStub { - DECLARE_DELAYED_SINGLETON(AccessTokenManagerService); - DECLEAR_SYSTEM_ABILITY(AccessTokenManagerService); - -public: - void OnStart() override; - void OnStop() override; - - int VerifyAccesstoken(AccessTokenID tokenID, const std::string& permissionName) override; - -private: - bool Initialize() const; - - ServiceRunningState state_; -}; -} // namespace AccessToken -} // namespace Security -} // namespace OHOS -#endif // ACCESSTOKEN_MANAGER_SERVICE_H diff --git a/services/accesstoken/main/cpp/include/accesstoken_manager_stub.h b/services/accesstoken/main/cpp/include/accesstoken_manager_stub.h deleted file mode 100644 index ffcbf3d577336d85fc8ad417bfcd7701674ef10e..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/cpp/include/accesstoken_manager_stub.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef ACCESSTOKEN_MANAGER_STUB_H -#define ACCESSTOKEN_MANAGER_STUB_H - -#include "i_accesstoken_manager.h" - -#include "iremote_stub.h" -#include "nocopyable.h" - -namespace OHOS { -namespace Security { -namespace AccessToken { -class AccessTokenManagerStub : public IRemoteStub { -public: - AccessTokenManagerStub() = default; - virtual ~AccessTokenManagerStub() = default; - - int OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& options) override; - -private: - void VerifyAccessTokenInner(MessageParcel& data, MessageParcel& reply); - -}; -} // namespace AccessToken -} // namespace Security -} // namespace OHOS -#endif // ACCESSTOKEN_MANAGER_STUB_H diff --git a/services/accesstoken/main/cpp/src/accesstoken_manager_service.cpp b/services/accesstoken/main/cpp/src/accesstoken_manager_service.cpp deleted file mode 100644 index 2b4bda1093836067b613bb27d0a177437d82c90d..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/cpp/src/accesstoken_manager_service.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "accesstoken_manager_service.h" - -#include "accesstoken.h" -#include "accesstoken_log.h" - -namespace OHOS { -namespace Security { -namespace AccessToken { -namespace { -static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, SECURITY_DOMAIN_ACCESSTOKEN, "AccessTokenManagerService"}; -} - -const bool REGISTER_RESULT = - SystemAbility::MakeAndRegisterAbility(DelayedSingleton::GetInstance().get()); - -AccessTokenManagerService::AccessTokenManagerService() - : SystemAbility(SA_ID_ACCESSTOKEN_MANAGER_SERVICE, true), state_(ServiceRunningState::STATE_NOT_START) -{ - ACCESSTOKEN_LOG_INFO(LABEL, "AccessTokenManagerService()"); -} - -AccessTokenManagerService::~AccessTokenManagerService() -{ - ACCESSTOKEN_LOG_INFO(LABEL, "~AccessTokenManagerService()"); -} - -void AccessTokenManagerService::OnStart() -{ - if (state_ == ServiceRunningState::STATE_RUNNING) { - ACCESSTOKEN_LOG_INFO(LABEL, "AccessTokenManagerService has already started!"); - return; - } - ACCESSTOKEN_LOG_INFO(LABEL, "AccessTokenManagerService is starting"); - if (!Initialize()) { - ACCESSTOKEN_LOG_ERROR(LABEL, "Failed to initialize"); - return; - } - state_ = ServiceRunningState::STATE_RUNNING; - bool ret = Publish(DelayedSingleton::GetInstance().get()); - if (!ret) { - ACCESSTOKEN_LOG_ERROR(LABEL, "Failed to publish service!"); - return; - } - ACCESSTOKEN_LOG_INFO(LABEL, "Congratulations, AccessTokenManagerService start successfully!"); -} - -void AccessTokenManagerService::OnStop() -{ - ACCESSTOKEN_LOG_INFO(LABEL, "stop service"); - state_ = ServiceRunningState::STATE_NOT_START; -} - -int AccessTokenManagerService::VerifyAccesstoken(AccessTokenID tokenID, const std::string &permissionName) -{ - ACCESSTOKEN_LOG_INFO(LABEL, - "%{public}s called, tokenID: %{public}d, permissionName: %{public}s", __func__, - tokenID, permissionName.c_str()); - return PERMISSION_GRANTED; -} - -bool AccessTokenManagerService::Initialize() const -{ - return true; -} -} // namespace AccessToken -} // namespace Security -} // namespace OHOS \ No newline at end of file diff --git a/services/accesstoken/main/cpp/src/accesstoken_manager_stub.cpp b/services/accesstoken/main/cpp/src/accesstoken_manager_stub.cpp deleted file mode 100644 index a8b1c6cef1c0d79327be52956cc7bd70963bb7f1..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/cpp/src/accesstoken_manager_stub.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2021 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "accesstoken_manager_stub.h" - -#include "accesstoken.h" -#include "accesstoken_log.h" - -#include "ipc_skeleton.h" -#include "string_ex.h" - -namespace OHOS { -namespace Security { -namespace AccessToken { -namespace { -static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = { - LOG_CORE, SECURITY_DOMAIN_ACCESSTOKEN, "AccessTokenManagerStub" -}; -} - -int32_t AccessTokenManagerStub::OnRemoteRequest( - uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) -{ - ACCESSTOKEN_LOG_INFO(LABEL, "%{public}s called, code: %{public}d", __func__, code); - std::u16string descriptor = data.ReadInterfaceToken(); - if (descriptor != IAccessTokenManager::GetDescriptor()) { - ACCESSTOKEN_LOG_ERROR(LABEL, "get unexpect descriptor: %{public}s", Str16ToStr8(descriptor).c_str()); - return RET_FAILED; - } - switch (code) { - case static_cast(IAccessTokenManager::InterfaceCode::VERIFY_ACCESSTOKEN): - VerifyAccessTokenInner(data, reply); - break; - default: - return IPCObjectStub::OnRemoteRequest(code, data, reply, option); - } - return NO_ERROR; -} - -void AccessTokenManagerStub::VerifyAccessTokenInner(MessageParcel& data, MessageParcel& reply) -{ - AccessTokenID tokenID = data.ReadUint32(); - std::string permissionName = data.ReadString(); - int result = this->VerifyAccesstoken(tokenID, permissionName); - reply.WriteInt32(result); -} -} // namespace AccessToken -} // namespace Security -} // namespace OHOS \ No newline at end of file diff --git a/services/accesstoken/main/sa_profile/3503.xml b/services/accesstoken/main/sa_profile/3503.xml deleted file mode 100755 index 622c5f8a5bcaad7bb69f6a0e585925d3ea2b7256..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/sa_profile/3503.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - foundation - - 3503 - libaccesstoken_manager_service.z.so - true - false - 1 - - \ No newline at end of file diff --git a/services/accesstoken/main/sa_profile/BUILD.gn b/services/accesstoken/main/sa_profile/BUILD.gn deleted file mode 100644 index c199a410c692bb3ecc713336c8f02718acf3731f..0000000000000000000000000000000000000000 --- a/services/accesstoken/main/sa_profile/BUILD.gn +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import("//build/ohos/sa_profile/sa_profile.gni") - -ohos_sa_profile("accesstoken_sa_profile_standard") { - part_name = "access_token" - - sources = [ "3503.xml" ] -}