• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 /**
17  * @file user_access_ctrl_client.h
18  *
19  * @brief The definition of user access ctrl client.
20  * @since 5.1
21  * @version 1.0
22  */
23 
24 #ifndef USER_ACCESS_CTRL_CLIENT_H
25 #define USER_ACCESS_CTRL_CLIENT_H
26 
27 #include <memory>
28 #include <vector>
29 
30 #include "user_access_ctrl_client_callback.h"
31 
32 namespace OHOS {
33 namespace UserIam {
34 namespace UserAuth {
35 class UserAccessCtrlClient {
36 public:
37     /**
38      * @brief Get user access ctrl client's instance.
39      *
40      * @return UserAccessCtrlClient's instance.
41      */
42     static UserAccessCtrlClient &GetInstance();
43 
44     /**
45      * @brief Deconstructor.
46      */
47     virtual ~UserAccessCtrlClient() = default;
48 
49     /**
50      * @brief Verify token and return the plainText.
51      *
52      * @param tokenIn Token signed by userAuth.
53      * @param allowableDuration Allowable duration of token, between 0 and MAX_TOKEN_ALLOWABLE_DURATION.
54      * @param callback Callback of verify auth token result.
55      *
56      * @return Return get result(0:success; other:failed).
57      */
58     virtual void VerifyAuthToken(const std::vector<uint8_t> &tokenIn, uint64_t allowableDuration,
59         const std::shared_ptr<VerifyTokenCallback> &callback) = 0;
60 };
61 } // namespace UserAuth
62 } // namespace UserIam
63 } // namespace OHOS
64 #endif // USER_ACCESS_CTRL_CLIENT_H