• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @file user_idm_client_callback.h
18  *
19  * @brief Callback definitions returned by idm client.
20  * @since 3.1
21  * @version 3.2
22  */
23 
24 #ifndef USER_IDM_CLIENT_CALLBACK_H
25 #define USER_IDM_CLIENT_CALLBACK_H
26 
27 #include "attributes.h"
28 #include "iam_common_defines.h"
29 #include "user_idm_client_defines.h"
30 
31 namespace OHOS {
32 namespace UserIam {
33 namespace UserAuth {
34 class GetCredentialInfoCallback {
35 public:
36     /**
37      * @brief The callback return get credential info result.
38      *
39      * @param result The result success or error code{@link ResultCode}.
40      * @param infoList The credential info list.
41      */
42     virtual void OnCredentialInfo(int32_t result, const std::vector<CredentialInfo> &infoList) = 0;
43 };
44 
45 class GetSecUserInfoCallback {
46 public:
47     /**
48      * @brief The callback return get security user info result.
49      *
50      * @param result The result success or error code{@link ResultCode}.
51      * @param info The security user info.
52      */
53     virtual void OnSecUserInfo(int32_t result, const SecUserInfo &info) = 0;
54 };
55 
56 class UserIdmClientCallback {
57 public:
58     /**
59      * @brief The callback return authenticate acquire information.
60      *
61      * @param module Module of current acquire info.
62      * @param acquireInfo Acquire info needed to be pass in.
63      * @param extraInfo Other related information about authentication.
64      */
65     virtual void OnAcquireInfo(int32_t module, uint32_t acquireInfo, const Attributes &extraInfo) = 0;
66 
67     /**
68      * @brief The callback return set property result.
69      *
70      * @param result The result success or error code{@link ResultCode}.
71      * @param extraInfo Other related information about set property.
72      */
73     virtual void OnResult(int32_t result, const Attributes &extraInfo) = 0;
74 };
75 
76 class CredChangeEventListener {
77 public:
78     /**
79      * @brief Notify the event of cred change.
80      *
81      * @param userId The id of user who change cred.
82      * @param authType The authentication auth type{@link AuthType}.
83      * @param eventType eventType of cred change, such as addCred and updateCred.
84      * @param changeInfo The credential change info.
85      */
86     virtual void OnNotifyCredChangeEvent(int32_t userId, AuthType authType, CredChangeEventType eventType,
87         const CredChangeEventInfo &changeInfo) = 0;
88 };
89 } // namespace UserAuth
90 } // namespace UserIam
91 } // namespace OHOS
92 
93 #endif // USER_IDM_CLIENT_CALLBACK_H