1 /* 2 * Copyright (C) 2022-2023 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 #include "group_auth_manager.h" 17 #include "common_defs.h" 18 #include "hc_dev_info.h" 19 #include "hc_log.h" 20 #include "hc_string.h" 21 #include "hc_types.h" 22 #include "compatible_auth_sub_session_util.h" 23 #include "account_related_group_auth.h" 24 #include "account_unrelated_group_auth.h" 25 GetAccountGroupAuth(int32_t groupAuthType)26static BaseGroupAuth *GetAccountGroupAuth(int32_t groupAuthType) 27 { 28 switch (groupAuthType) { 29 case ACCOUNT_UNRELATED_GROUP_AUTH_TYPE: 30 LOGI("Non-account auth type."); 31 return GetAccountUnrelatedGroupAuth(); 32 case ACCOUNT_RELATED_GROUP_AUTH_TYPE: 33 LOGI("Account-related auth type."); 34 return GetAccountRelatedGroupAuth(); 35 default: 36 LOGE("Invalid auth type!"); 37 } 38 return NULL; 39 } 40 InitGroupAuthManager(void)41int32_t InitGroupAuthManager(void) 42 { 43 RegisterGroupAuth(GetAccountGroupAuth); 44 LOGI("[GroupAuthManager]: Init success!"); 45 return HC_SUCCESS; 46 } 47