1 /* 2 * Copyright (c) 2022-2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_INCLUDE_DOMAIN_ACCOUNT_PLUGIN_SERVICE_H 17 #define OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_INCLUDE_DOMAIN_ACCOUNT_PLUGIN_SERVICE_H 18 19 #include <string> 20 #include "account_error_no.h" 21 #include "domain_account_callback_client.h" 22 #include "domain_account_common.h" 23 #include "domain_account_plugin.h" 24 #include "domain_account_plugin_stub.h" 25 #include "want.h" 26 27 namespace OHOS { 28 namespace AccountSA { 29 class DomainAccountPluginService : public DomainAccountPluginStub { 30 public: 31 explicit DomainAccountPluginService(const std::shared_ptr<DomainAccountPlugin> &plugin); 32 ~DomainAccountPluginService() override; 33 ErrCode Auth(const DomainAccountInfo &info, const std::vector<uint8_t> &password, 34 const sptr<IDomainAccountCallback> &callback) override; 35 ErrCode AuthWithPopup(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override; 36 ErrCode AuthWithToken(const DomainAccountInfo &info, const std::vector<uint8_t> &token, 37 const sptr<IDomainAccountCallback> &callback) override; 38 ErrCode GetAuthStatusInfo(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override; 39 ErrCode GetDomainAccountInfo(const GetDomainAccountInfoOptions &options, 40 const sptr<IDomainAccountCallback> &callback) override; 41 ErrCode OnAccountBound(const DomainAccountInfo &info, const int32_t localId, 42 const sptr<IDomainAccountCallback> &callback) override; 43 ErrCode OnAccountUnBound(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override; 44 ErrCode IsAccountTokenValid(const DomainAccountInfo &info, const std::vector<uint8_t> &token, 45 const sptr<IDomainAccountCallback> &callback) override; 46 ErrCode GetAccessToken(const DomainAccountInfo &domainInfo, const std::vector<uint8_t> &accountToken, 47 const GetAccessTokenOptions &option, const sptr<IDomainAccountCallback> &callback) override; 48 49 private: 50 ErrCode CheckAndInitExecEnv(const sptr<IDomainAccountCallback> &callback, 51 DomainAccountCallbackClient **callbackClient); 52 ErrCode AuthCommonInterface(const DomainAccountInfo &info, const std::vector<uint8_t> &authData, 53 const sptr<IDomainAccountCallback> &callback, AuthMode authMode); 54 std::shared_ptr<DomainAccountPlugin> innerPlugin_; 55 DISALLOW_COPY_AND_MOVE(DomainAccountPluginService); 56 }; 57 } // namespace AccountSA 58 } // namespace OHOS 59 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_INCLUDE_DOMAIN_ACCOUNT_PLUGIN_SERVICE_H 60