同步操作将从 OpenHarmony/security_access_token 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
AccessTokenManager (ATM) provides unified app permission management based on access tokens on OpenHarmony.
The access token information of an app includes the app identifier (APPID), user ID, app twin index, app Ability Privilege Level (APL), and permission information. The access token of each app is identified by a 32-bit token identity (TokenID) in the device.
The ATM module provides the following functions:
/base/security/access_token
├── frameworks # Stores code of basic functionalities.
│ ├── accesstoken # Stores code of the ATM framework.
│ ├── tokensync # Stores code of the access token synchronization framework.
│ └── common # Stores framework common code.
├── interfaces # Stores the APIs.
│ ├── innerkits # Stores internal APIs.
│ ├── accesstoken # Stores code of access token internal APIs.
│ ├── nativetoken # Stores code of native token APIs.
│ └── tokensync # Stores code of the internal APIs for access token synchronization.
└── services # Services
├── accesstokenmanager # Stores ATM service code.
└── tokensyncmanager # Stores code of the access token synchronization service.
API | Description |
---|---|
AccessTokenIDEx AllocHapToken(const HapInfoParams& info, const HapPolicyParams& policy); | Allocates a token ID to an app. |
AccessTokenID AllocLocalTokenID(const std::string& remoteDeviceID, AccessTokenID remoteTokenID); | Allocates a local token ID to the app of a remote device. |
int UpdateHapToken(AccessTokenID tokenID, const std::string& appIDDesc, const HapPolicyParams& policy); | Updates token information. |
int DeleteToken(AccessTokenID tokenID); | Deletes the app's token ID and information. |
int GetTokenType(AccessTokenID tokenID); | Obtains the type of an access token. |
int CheckNativeDCap(AccessTokenID tokenID, const std::string& dcap); | Checks whether the native process corresponding to the given token ID has the specified distributed capability. |
AccessTokenID GetHapTokenID(int userID, const std::string& bundleName, int instIndex); | Obtains the token ID of an app. |
int GetHapTokenInfo(AccessTokenID tokenID, HapTokenInfo& hapTokenInfoRes); | Obtains the token information about a HAP. |
int GetNativeTokenInfo(AccessTokenID tokenID, NativeTokenInfo& nativeTokenInfoRes); | Obtains information about a native token. |
int VerifyAccessToken(AccessTokenID tokenID, const std::string& permissionName); | Checks whether an access token has the specified permission. |
int GetDefPermission(const std::string& permissionName, PermissionDef& permissionDefResult); | Obtains definition information about the specified permission. |
int GetDefPermissions(AccessTokenID tokenID, std::vector& permList); | Obtains the permission definition set of a HAP. |
int GetReqPermissions(AccessTokenID tokenID, std::vector& reqPermList, bool isSystemGrant); | Obtains the status set of the permission requested by a HAP. |
int GetPermissionFlag(AccessTokenID tokenID, const std::string& permissionName); | Obtains the permissions of the app with the specified token ID. |
int GrantPermission(AccessTokenID tokenID, const std::string& permissionName, int flag); | Grants the specified permission to the app with the specified token ID. |
int RevokePermission(AccessTokenID tokenID, const std::string& permissionName, int flag); | Revokes the specified permission from the app with the specified token ID. |
int ClearUserGrantedPermissionState(AccessTokenID tokenID); | Clears the user_grant permission status of the app with the specified token ID. |
uint64_t GetAccessTokenId(const char *processname, const char **dcap, int32_t dacpNum, const char *aplStr); | Obtains the token ID of a native process. |
ATM provides unified access control for apps and allows apps or service abilities to obtain and verify app permissions and APL. The ATM APIs can be called by a service ability started by a native process or an app HAP.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。