1 /* 2 * Copyright (c) 2022 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_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_MGR_PROXY_H 17 #define OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_MGR_PROXY_H 18 19 #include "account_error_no.h" 20 #include "account_iam_info.h" 21 #include "iaccount_iam.h" 22 #include "iremote_proxy.h" 23 24 namespace OHOS { 25 namespace AccountSA { 26 class AccountIAMMgrProxy : public IRemoteProxy<IAccountIAM> { 27 public: 28 explicit AccountIAMMgrProxy(const sptr<IRemoteObject> &object); 29 ~AccountIAMMgrProxy() override; 30 31 int32_t OpenSession(int32_t userId, std::vector<uint8_t> &challenge) override; 32 int32_t CloseSession(int32_t userId) override; 33 void AddCredential( 34 int32_t userId, const CredentialParameters &credInfo, const sptr<IIDMCallback> &callback) override; 35 void UpdateCredential(int32_t userId, const CredentialParameters &credInfo, 36 const sptr<IIDMCallback> &callback) override; 37 int32_t Cancel(int32_t userId) override; 38 void DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken, 39 const sptr<IIDMCallback> &callback) override; 40 void DelUser(int32_t userId, const std::vector<uint8_t> &authToken, const sptr<IIDMCallback> &callback) override; 41 int32_t GetCredentialInfo( 42 int32_t userId, AuthType authType, const sptr<IGetCredInfoCallback> &callback) override; 43 uint64_t AuthUser(int32_t userId, const std::vector<uint8_t> &challenge, AuthType authType, 44 AuthTrustLevel authTrustLevel, const sptr<IIDMCallback> &callback) override; 45 int32_t CancelAuth(uint64_t contextId) override; 46 int32_t GetAvailableStatus(AuthType authType, AuthTrustLevel authTrustLevel, int32_t &status) override; 47 void GetProperty( 48 int32_t userId, const GetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) override; 49 void SetProperty( 50 int32_t userId, const SetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) override; 51 IAMState GetAccountState(int32_t userId) override; 52 53 private: 54 ErrCode SendRequest(IAccountIAM::Message code, MessageParcel &data, MessageParcel &reply); 55 void AddOrUpdateCredential(int32_t userId, const CredentialParameters &credInfo, 56 const sptr<IIDMCallback> &callback, bool isAdd); 57 bool WriteCommonData(MessageParcel &data, int32_t userId); 58 59 private: 60 static inline BrokerDelegator<AccountIAMMgrProxy> delegator_; 61 }; 62 } // namespace AccountSA 63 } // namespace OHOS 64 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_MGR_PROXY_H