• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2025 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_ACCOUNT_IAM_SERVICE_H
17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_IAM_SERVICE_H
18 
19 #include <vector>
20 
21 #include "account_error_no.h"
22 #include "account_i_a_m_stub.h"
23 
24 namespace OHOS {
25 namespace AccountSA {
26 class AccountIAMService : public AccountIAMStub {
27 public:
28     AccountIAMService();
29     ~AccountIAMService() override;
30 
31     int32_t OpenSession(int32_t userId, std::vector<uint8_t>& challenge) override;
32     int32_t CloseSession(int32_t userId) override;
33     int32_t AddCredential(
34         int32_t userId, const CredentialParametersIam& credInfoIam, const sptr<IIDMCallback>& idmCallback) override;
35     int32_t UpdateCredential(
36         int32_t userId, const CredentialParametersIam& credInfoIam, const sptr<IIDMCallback>& idmCallback) override;
37     int32_t Cancel(int32_t userId) override;
38     int32_t DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t>& authToken,
39         const sptr<IIDMCallback>& idmCallback) override;
40     int32_t DelUser(
41         int32_t userId, const std::vector<uint8_t>& authToken, const sptr<IIDMCallback>& idmCallback) override;
42     int32_t GetCredentialInfo(
43         int32_t userId, int32_t authTypeInt, const sptr<IGetCredInfoCallback>& getCredInfoCallback) override;
44     int32_t PrepareRemoteAuth(
45         const std::string& remoteNetworkId, const sptr<IPreRemoteAuthCallback>& preRemoteAuthCallback) override;
46     int32_t AuthUser(const AuthParam& authParam, const sptr<IIDMCallback>& idmCallback, uint64_t& contextId) override;
47     int32_t CancelAuth(uint64_t contextId) override;
48     int32_t GetAvailableStatus(int32_t authTypeInt, uint32_t authTrustLevelInt, int32_t& status) override;
49     int32_t GetProperty(int32_t userId, const GetPropertyRequestIam& request,
50         const sptr<IGetSetPropCallback>& getSetPropCallback) override;
51     int32_t GetPropertyByCredentialId(uint64_t credentialId, const std::vector<int32_t>& keysInt,
52         const sptr<IGetSetPropCallback>& getSetPropCallback) override;
53     int32_t SetProperty(
54         int32_t userId, const SetPropertyRequestIam& request, const sptr<IGetSetPropCallback>& callback) override;
55     int32_t GetEnrolledId(
56         int32_t accountId, int32_t authTypeInt, const sptr<IGetEnrolledIdCallback>& getEnrolledIdCallback) override;
57     int32_t GetAccountState(int32_t userId, int32_t& funcResult) override;
58     int32_t CallbackEnter([[maybe_unused]] uint32_t code) override;
CallbackExit(uint32_t code,int32_t result)59     int32_t CallbackExit([[maybe_unused]] uint32_t code, [[maybe_unused]] int32_t result) override
60     {
61         return ERR_OK;
62     }
63 
64 private:
65     bool CheckPermission(const std::string &permission);
66     DISALLOW_COPY_AND_MOVE(AccountIAMService);
67 };
68 }  // namespace AccountSA
69 }  // namespace OHOS
70 #endif  // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_IAM_SERVICE_H
71