• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 USERIDM_PROXY_H
17 #define USERIDM_PROXY_H
18 
19 #include <iremote_proxy.h>
20 #include "iuser_idm.h"
21 
22 namespace OHOS {
23 namespace UserIAM {
24 namespace UserIDM {
25 class UserIDMProxy : public IRemoteProxy<IUserIDM> {
26 public:
UserIDMProxy(const sptr<IRemoteObject> & object)27     explicit UserIDMProxy(const sptr<IRemoteObject> &object)
28         :IRemoteProxy<IUserIDM>(object) {}
29     ~UserIDMProxy() override = default;
30 
31     uint64_t OpenSession() override;
32     void CloseSession() override;
33     int32_t GetAuthInfo(AuthType authType, const sptr<IGetInfoCallback> &callback) override;
34     int32_t GetAuthInfo(int32_t userId, AuthType authType, const sptr<IGetInfoCallback> &callback) override;
35     int32_t GetSecInfo(int32_t userId, const sptr<IGetSecInfoCallback> &callback) override;
36     void AddCredential(AddCredInfo &credInfo, const sptr<IIDMCallback> &callback) override;
37     void UpdateCredential(AddCredInfo &credInfo, const sptr<IIDMCallback> &callback) override;
38     int32_t Cancel(uint64_t challenge) override;
39     int32_t EnforceDelUser(int32_t userId, const sptr<IIDMCallback> &callback) override;
40     void DelUser(std::vector<uint8_t> authToken, const sptr<IIDMCallback> &callback) override;
41     void DelCred(uint64_t credentialId, std::vector<uint8_t> authToken, const sptr<IIDMCallback> &callback) override;
42 
43 private:
44     bool SendRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, bool isSync = true);
45 
46 private:
47     static inline BrokerDelegator<UserIDMProxy> delegator_;
48 };
49 }  // namespace UserIDM
50 }  // namespace UserIAM
51 }  // namespace OHOS
52 
53 
54 #endif // USERIDM_PROXY_H
55