1 /* 2 * Copyright (c) 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 LOCAL_REMOTE_AUTH_CONTEXT_H 17 #define LOCAL_REMOTE_AUTH_CONTEXT_H 18 19 #include <cstdint> 20 #include <memory> 21 #include <mutex> 22 23 #include "authentication_impl.h" 24 #include "simple_auth_context.h" 25 26 namespace OHOS { 27 namespace UserIam { 28 namespace UserAuth { 29 struct LocalRemoteAuthContextParam { 30 std::string collectorNetworkId; 31 }; 32 33 class LocalRemoteAuthContext : public SimpleAuthContext { 34 public: 35 LocalRemoteAuthContext(uint64_t contextId, std::shared_ptr<Authentication> auth, LocalRemoteAuthContextParam ¶m, 36 std::shared_ptr<ContextCallback> callback); 37 ~LocalRemoteAuthContext() override; 38 ContextType GetContextType() const override; 39 40 void OnTimeOut(); 41 42 protected: 43 bool OnStart() override; 44 45 #ifndef IAM_TEST_ENABLE 46 private: 47 #endif 48 std::recursive_mutex mutex_; 49 std::string collectorNetworkId_; 50 std::optional<uint32_t> cancelTimerId_ = std::nullopt; 51 }; 52 53 } // namespace UserAuth 54 } // namespace UserIam 55 } // namespace OHOS 56 57 #endif // LOCAL_REMOTE_AUTH_CONTEXT_H 58