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_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H 17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H 18 19 #include "iaccount_iam.h" 20 21 #include <map> 22 #include "account_error_no.h" 23 #include "iremote_stub.h" 24 25 namespace OHOS { 26 namespace AccountSA { 27 class AccountIAMMgrStub : public IRemoteStub<IAccountIAM> { 28 public: 29 using MessageProcFunction = ErrCode (AccountIAMMgrStub::*)(MessageParcel &data, MessageParcel &reply); 30 AccountIAMMgrStub(); 31 ~AccountIAMMgrStub() override; 32 int OnRemoteRequest( 33 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 34 35 private: 36 ErrCode ProcOpenSession(MessageParcel &data, MessageParcel &reply); 37 ErrCode ProcCloseSession(MessageParcel &data, MessageParcel &reply); 38 ErrCode ProcAddCredential(MessageParcel &data, MessageParcel &reply); 39 ErrCode ProcUpdateCredential(MessageParcel &data, MessageParcel &reply); 40 ErrCode ProcDelCred(MessageParcel &data, MessageParcel &reply); 41 ErrCode ProcDelUser(MessageParcel &data, MessageParcel &reply); 42 ErrCode ProcCancel(MessageParcel &data, MessageParcel &reply); 43 ErrCode ProcGetCredentialInfo(MessageParcel &data, MessageParcel &reply); 44 ErrCode ProcAuthUser(MessageParcel &data, MessageParcel &reply); 45 ErrCode ProcCancelAuth(MessageParcel &data, MessageParcel &reply); 46 ErrCode ProcGetAvailableStatus(MessageParcel &data, MessageParcel &reply); 47 ErrCode ProcGetProperty(MessageParcel &data, MessageParcel &reply); 48 ErrCode ProcSetProperty(MessageParcel &data, MessageParcel &reply); 49 ErrCode ProcGetAccountState(MessageParcel &data, MessageParcel &reply); 50 ErrCode ReadUserIdAndAuthType(MessageParcel &data, int32_t &userId, int32_t &authType); 51 ErrCode AddOrUpdateCredential(MessageParcel &data, MessageParcel &reply, bool isAdd = true); 52 bool CheckPermission(const std::string &permission); 53 54 private: 55 static const std::map<uint32_t, MessageProcFunction> messageProcMap_; 56 DISALLOW_COPY_AND_MOVE(AccountIAMMgrStub); 57 }; 58 } // namespace AccountSA 59 } // namespace OHOS 60 #endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_IAM_STUB_H