1 /* 2 * Copyright (c) 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 REMOTE_AUTH_SERVICE_H 17 #define REMOTE_AUTH_SERVICE_H 18 19 #include <map> 20 #include <mutex> 21 #include <string> 22 23 #include "attributes.h" 24 #include "authentication.h" 25 #include "context_callback.h" 26 #include "remote_auth_context.h" 27 #include "remote_connect_manager.h" 28 29 namespace OHOS { 30 namespace UserIam { 31 namespace UserAuth { 32 class RemoteAuthService { 33 public: 34 static RemoteAuthService &GetInstance(); 35 RemoteAuthService() = default; 36 virtual ~RemoteAuthService() = default; 37 38 virtual bool Start() = 0; 39 virtual void OnMessage(const std::string &connectionName, const std::string &srcEndPoint, 40 const std::shared_ptr<Attributes> &request, std::shared_ptr<Attributes> &reply) = 0; 41 42 virtual int32_t ProcStartRemoteAuthRequest(std::string connectionName, const std::shared_ptr<Attributes> &request, 43 std::shared_ptr<Attributes> &reply) = 0; 44 virtual int32_t ProcQueryExecutorInfoRequest(const std::shared_ptr<Attributes> &request, 45 std::shared_ptr<Attributes> &reply) = 0; 46 virtual int32_t ProcBeginExecuteRequest(const std::shared_ptr<Attributes> &request, 47 std::shared_ptr<Attributes> &reply) = 0; 48 virtual int32_t ProcEndExecuteRequest(const std::shared_ptr<Attributes> &request, 49 std::shared_ptr<Attributes> &reply) = 0; 50 51 virtual uint64_t StartRemoteAuthContext(Authentication::AuthenticationPara para, 52 RemoteAuthContextParam remoteAuthContextParam, 53 const std::shared_ptr<ContextCallback> &contextCallback, int &lastError); 54 }; 55 } // namespace UserAuth 56 } // namespace UserIam 57 } // namespace OHOS 58 #endif // REMOTE_AUTH_SERVICE_H