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 #include "dm_accesstoken_kit_mock.h"
17
18 using namespace OHOS::DistributedHardware;
19
20 namespace OHOS {
21 namespace Security {
22 namespace AccessToken {
GetTokenTypeFlag(AccessTokenID tokenID)23 ATokenTypeEnum AccessTokenKit::GetTokenTypeFlag(AccessTokenID tokenID)
24 {
25 return DmAccessTokenKit::accessToken_->GetTokenTypeFlag(tokenID);
26 }
27
GetHapTokenInfo(AccessTokenID tokenID,HapTokenInfo & hapTokenInfoRes)28 int AccessTokenKit::GetHapTokenInfo(AccessTokenID tokenID, HapTokenInfo &hapTokenInfoRes)
29 {
30 return DmAccessTokenKit::accessToken_->GetHapTokenInfo(tokenID, hapTokenInfoRes);
31 }
32
GetNativeTokenInfo(AccessTokenID tokenID,NativeTokenInfo & nativeTokenInfoRes)33 int AccessTokenKit::GetNativeTokenInfo(AccessTokenID tokenID, NativeTokenInfo &nativeTokenInfoRes)
34 {
35 return DmAccessTokenKit::accessToken_->GetNativeTokenInfo(tokenID, nativeTokenInfoRes);
36 }
37
GetNativeTokenId(const std::string & GetNativeTokenId)38 AccessTokenID AccessTokenKit::GetNativeTokenId(const std::string &GetNativeTokenId)
39 {
40 return DmAccessTokenKit::accessToken_->GetNativeTokenId(GetNativeTokenId);
41 }
42
GetHapTokenID(int32_t userID,const std::string & bundleName,int32_t instIndex)43 AccessTokenID AccessTokenKit::GetHapTokenID(int32_t userID, const std::string &bundleName, int32_t instIndex)
44 {
45 return DmAccessTokenKit::accessToken_->GetHapTokenID(userID, bundleName, instIndex);
46 }
47
VerifyAccessToken(AccessTokenID tokenID,const std::string & permissionName)48 int AccessTokenKit::VerifyAccessToken(AccessTokenID tokenID, const std::string& permissionName)
49 {
50 return DmAccessTokenKit::accessToken_->VerifyAccessToken(tokenID, permissionName);
51 }
52 } // namespace AccessToken
53 } // namespace Security
54 } // namespace OHOS
55