1 /* 2 * Copyright (c) 2022-2024 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_CALLBACK_SERVICE_H 17 #define OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_CALLBACK_SERVICE_H 18 19 #include "account_iam_callback_stub.h" 20 #include "account_iam_client_callback.h" 21 #include "account_iam_info.h" 22 #include "domain_account_common.h" 23 #include "domain_account_callback.h" 24 25 namespace OHOS { 26 namespace AccountSA { 27 class IDMCallbackService : public IDMCallbackStub { 28 public: 29 IDMCallbackService(int32_t userId, const std::shared_ptr<IDMCallback> &callback); 30 void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) override; 31 void OnResult(int32_t result, const Attributes &extraInfo) override; 32 33 private: 34 int32_t userId_; 35 std::shared_ptr<IDMCallback> callback_; 36 DISALLOW_COPY_AND_MOVE(IDMCallbackService); 37 }; 38 39 class GetCredInfoCallbackService : public GetCredInfoCallbackStub { 40 public: 41 explicit GetCredInfoCallbackService(const std::shared_ptr<GetCredInfoCallback> &callback); 42 void OnCredentialInfo(const std::vector<CredentialInfo> &infoList) override; 43 44 private: 45 std::shared_ptr<GetCredInfoCallback> callback_; 46 DISALLOW_COPY_AND_MOVE(GetCredInfoCallbackService); 47 }; 48 49 class GetSetPropCallbackService : public GetSetPropCallbackStub { 50 public: 51 explicit GetSetPropCallbackService(const std::shared_ptr<GetSetPropCallback> &callback); 52 void OnResult(int32_t result, const Attributes &extraInfo) override; 53 54 private: 55 std::shared_ptr<GetSetPropCallback> callback_; 56 DISALLOW_COPY_AND_MOVE(GetSetPropCallbackService); 57 }; 58 59 class GetEnrolledIdCallbackService : public GetEnrolledIdCallbackStub { 60 public: 61 explicit GetEnrolledIdCallbackService(const std::shared_ptr<GetEnrolledIdCallback> &callback); 62 void OnEnrolledId(int32_t result, uint64_t enrolledId) override; 63 64 private: 65 std::shared_ptr<GetEnrolledIdCallback> callback_; 66 DISALLOW_COPY_AND_MOVE(GetEnrolledIdCallbackService); 67 }; 68 69 class PreRemoteAuthCallbackService : public PreRemoteAuthCallbackStub { 70 public: 71 explicit PreRemoteAuthCallbackService(const std::shared_ptr<PreRemoteAuthCallback> &callback); 72 void OnResult(int32_t result) override; 73 74 private: 75 std::shared_ptr<PreRemoteAuthCallback> callback_; 76 DISALLOW_COPY_AND_MOVE(PreRemoteAuthCallbackService); 77 }; 78 79 class DomainAuthCallbackAdapter final : public DomainAccountCallback { 80 public: 81 explicit DomainAuthCallbackAdapter(const std::shared_ptr<IDMCallback> &callback); 82 void OnResult(const int32_t errCode, Parcel &parcel) override; 83 84 private: 85 std::shared_ptr<IDMCallback> callback_; 86 }; 87 88 #ifdef HAS_PIN_AUTH_PART 89 class DomainCredentialRecipient : public IInputerData { 90 public: 91 DomainCredentialRecipient(int32_t userId, const std::shared_ptr<IDMCallback> &callback); 92 ~DomainCredentialRecipient() override; 93 void OnSetData(int32_t authSubType, std::vector<uint8_t> data) override; 94 95 private: 96 int32_t userId_; 97 std::shared_ptr<IDMCallback> idmCallback_; 98 }; 99 100 class IAMInputer final : public IInputer { 101 public: 102 IAMInputer(int32_t userId, const std::shared_ptr<IInputer> &inputer); 103 104 void OnGetData(int32_t authSubType, std::vector<uint8_t> challenge, 105 std::shared_ptr<IInputerData> inputerData) override; 106 private: 107 int32_t userId_; 108 std::shared_ptr<IInputer> innerInputer_ = nullptr; 109 }; 110 #endif 111 } // namespace AccountSA 112 } // namespace OHOS 113 #endif // OS_ACCOUNT_INTERFACES_INNERKITS_ACCOUNT_IAM_NATIVE_INCLUDE_ACCOUNT_IAM_CALLBACK_SERVICE_H 114