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_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H 17 #define OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H 18 19 #include <string> 20 #include "account_error_no.h" 21 #include "idomain_account.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace AccountSA { 26 class DomainAccountProxy : public IRemoteProxy<IDomainAccount> { 27 public: 28 explicit DomainAccountProxy(const sptr<IRemoteObject> &object); 29 ~DomainAccountProxy() override; 30 ErrCode RegisterPlugin(const sptr<IDomainAccountPlugin> &plugin) override; 31 ErrCode UnregisterPlugin() override; 32 ErrCode GetAccountStatus( 33 const DomainAccountInfo &info, DomainAccountStatus &status) override; 34 ErrCode RegisterAccountStatusListener(const sptr<IDomainAccountCallback> &listener) override; 35 ErrCode UnregisterAccountStatusListener(const sptr<IDomainAccountCallback> &listener) override; 36 ErrCode Auth(const DomainAccountInfo &info, const std::vector<uint8_t> &password, 37 const sptr<IDomainAccountCallback> &callback) override; 38 ErrCode AuthUser(int32_t userId, const std::vector<uint8_t> &password, 39 const sptr<IDomainAccountCallback> &callback) override; 40 ErrCode AuthWithPopup(int32_t userId, const sptr<IDomainAccountCallback> &callback) override; 41 ErrCode HasDomainAccount(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override; 42 ErrCode UpdateAccountToken(const DomainAccountInfo &info, const std::vector<uint8_t> &token) override; 43 ErrCode IsAuthenticationExpired(const DomainAccountInfo &info, bool &isExpired) override; 44 ErrCode SetAccountPolicy(const DomainAccountPolicy &policy) override; 45 ErrCode GetAccessToken(const DomainAccountInfo &info, const AAFwk::WantParams ¶meters, 46 const sptr<IDomainAccountCallback> &callback) override; 47 ErrCode GetDomainAccountInfo(const DomainAccountInfo &info, const sptr<IDomainAccountCallback> &callback) override; 48 ErrCode AddServerConfig(const std::string ¶mter, DomainServerConfig &config) override; 49 ErrCode RemoveServerConfig(const std::string &configId) override; 50 ErrCode GetAccountServerConfig(const DomainAccountInfo &info, DomainServerConfig &config) override; 51 ErrCode UpdateAccountInfo( 52 const DomainAccountInfo &oldAccountInfo, const DomainAccountInfo &newAccountInfo) override; 53 54 private: 55 ErrCode SendRequest(DomainAccountInterfaceCode code, MessageParcel &data, MessageParcel &reply); 56 57 private: 58 static inline BrokerDelegator<DomainAccountProxy> delegator_; 59 }; 60 } // namespace AccountSA 61 } // namespace OHOS 62 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_DOMAIN_ACCOUNT_NATIVE_INCLUDE_DOMAIN_ACCOUNT_PROXY_H