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_ACCOUNT_IAM_SERVICE_H 17 #define OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_IAM_SERVICE_H 18 19 #include <vector> 20 #include "account_iam_mgr_stub.h" 21 #include "account_error_no.h" 22 23 namespace OHOS { 24 namespace AccountSA { 25 class AccountIAMService : public AccountIAMMgrStub { 26 public: 27 AccountIAMService(); 28 ~AccountIAMService() override; 29 30 int32_t OpenSession(int32_t userId, std::vector<uint8_t> &challenge) override; 31 int32_t CloseSession(int32_t userId) override; 32 void AddCredential( 33 int32_t userId, const CredentialParameters &credInfo, const sptr<IIDMCallback> &callback) override; 34 void UpdateCredential( 35 int32_t userId, const CredentialParameters &credInfo, const sptr<IIDMCallback> &callback) override; 36 int32_t Cancel(int32_t userId) override; 37 void DelCred(int32_t userId, uint64_t credentialId, const std::vector<uint8_t> &authToken, 38 const sptr<IIDMCallback> &callback) override; 39 void DelUser(int32_t userId, const std::vector<uint8_t> &authToken, const sptr<IIDMCallback> &callback) override; 40 int32_t GetCredentialInfo( 41 int32_t userId, AuthType authType, const sptr<IGetCredInfoCallback> &callback) override; 42 int32_t AuthUser( 43 int32_t userId, const AuthParam &authParam, const sptr<IIDMCallback> &callback, uint64_t &contextId) override; 44 int32_t CancelAuth(uint64_t contextId) override; 45 int32_t GetAvailableStatus(AuthType authType, AuthTrustLevel authTrustLevel, int32_t &status) override; 46 void GetProperty( 47 int32_t userId, const GetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) override; 48 void SetProperty( 49 int32_t userId, const SetPropertyRequest &request, const sptr<IGetSetPropCallback> &callback) override; 50 IAMState GetAccountState(int32_t userId) override; 51 52 private: 53 bool GetCurrentUserId(int32_t &userId); 54 55 private: 56 DISALLOW_COPY_AND_MOVE(AccountIAMService); 57 }; 58 } // namespace AccountSA 59 } // namespace OHOS 60 #endif // OS_ACCOUNT_SERVICES_ACCOUNTMGR_INCLUDE_ACCOUNT_IAM_SERVICE_H 61