Identity Tokens
Generate and revoke scoped identity tokens in the JFrog Platform.
Understanding Identity Tokens
JFrog’s Access Tokens are standard JSON Web Tokens (JWTs). Because the tokens are standard JWTs, they can be quite long. They contain the token’s claims (scope, subject, and others), as well as additional information used to validate the token. The length of the token can create compatibility issues with various clients trying to authenticate with the JFrog Platform. Moreover, some clients might not even support bearer token authentication (Authorization: Bearer <TOKEN>). To mitigate these length limitations, JFrog introduced the Reference Token, which is simply a short string of characters that refers to an actual JWT Access token. Unlike a regular JWT token, reference tokens follow this pattern: .*\bcmVmd[A-Za-z0-9]{59}\b.*, starting with cmVmd followed by 59 more alphanumeric characters.
One type of access token is called an identity token, which is an access token that is scoped, or targeted, to a specific user’s permissions, or their identity. Because identity tokens are scoped tokens, they provide limited and focused permissions, and are revocable when a user is deleted or disabled, making them more secure. You can create a reference token of an identity token, to use for user authentication.
To obtain a reference token using REST API, you can use the Create Token REST API, by setting the include_reference_token parameter to true. You can also use the JFrog Platform UI Profile page to generate this token.
To create a reference token through the JFrog Platform UI, there are two methods: for more information, see Create an Admin-Scoped Token, and Generate Identity Token.
Generate Identity Token
Generate an Identity Token
The user profile enables you to generate identity tokens for yourself via the JFrog Platform UI. Identity tokens are scoped tokens, which means that they provide limited and focused permissions, making them more secure and, therefore, preferable to API keys. In addition, when a user is deleted or disabled, their tokens are also revoked. For more information, see Access Tokens.
Note
When creating a reference token, the maximum payload is 4,000 characters. The number or length of the groups associated with the token can affect this payload.
For SAML users, starting from JFrog Artifactory 7.117.1, the groups association is saved in the JFrog Platform, and doesn't add to the payload.
To generate an identity token:
-
Open your Artifactory profile by clicking the profile icon

and click Edit Profile from the dropdown list. The profile settings screen opens.
-
In the profile settings screen, click Generate an Identity Token.

This opens the Generate an Identity Token window.

-
(Optional) In the Add Description field, you can add an optional description for the new token, which will make it easier for you to identify the token.
-
Click Next.
You'll now see the new reference token displayed.

-
Click the Copy icon next to the token to copy the identity reference token.
-
Click Close to close the window.
The new token you generated appears with the description in the list of identity tokens:

Revoke an Identity Token
You can revoke an identity token from the token list in your profile.
To revoke an identity token:
-
Click the x symbol on the token row

-
Click Revoke.

Comparing Identity Reference Tokens With API Keys
When JFrog introduced API keys in Artifactory 4.4.3, API keys provided a way to create a secret. You could use this key instead of a password with Artifactory's REST APIs or through clients such as the JFrog CLI and package managers. However, this proved to be less secure, in part because people often reused the same password for multiple applications, API keys can be retrieved from a database, and API keys don't have lifecycle management features and never expire.
JFrog’s Identity Token, is an Access Token that is scoped (targeted) to a specific user’s permissions (their identity). Using an Identity Token is key to accessing the other types of tokens. Because JFrog’s Access tokens are standard JWTs, as such they can be quite long, so JFrog introduced the Reference Token, which is simply a short string of characters that refers to an actual token.
Unlike API Keys, Identity Tokens and Reference Tokens are a more secure way to manage user authentication because they inherit the security features of Access Tokens.
Compared with API keys, identity reference tokens have the following advantages:
- Reference tokens aren't retrievable. Identity tokens are stored as a hash, so they aren't retrievable from the UI, the REST API, or a database, making them less likely to be compromised.
- Reference tokens can have a default expiry. The Artifactory administrator can set a default expiry for reference tokens, control the default expiry time, and decide whether a token will be refreshable.
- You can have multiple identity tokens. Unlike API keys, you can create more than one identity token.
- You can view identity token information and revoke the token in the JFrog Platform UI. Administrators can do this too.
- You can use identity tokens as bearer tokens (
curl -H Authorization: Bearer <TOKEN>) and in Artifactory endpoints. Reference tokens can be used in a similar way to API keys, with theX-JFrog-Art-Apiheader, or as basic credentials (curl -u User1:<REFERENCE_TOKEN>). - Reference tokens are 64 characters. Unlike JWT tokens, reference tokens can be used with clients that don't support long tokens or passwords.
- Reference tokens follow this pattern:
.*\bcmVmd[A-Za-z0-9]{59}\b.*, starting withcmVmdand including 59 alphanumeric characters. API keys follow this pattern:.*\bAKCp[A-Za-z0-9]{69}\b.*, starting withAKCpand including 69 alphanumeric characters.
Frequently Asked Questions
This section provides answers to frequently asked questions.
FAQs
Q: How do I generate an identity token?
A: In the JFrog Platform, open your profile, click Edit Profile, and then click Generate an Identity Token. Copy the reference token before you close the window. For more information, see Generate an Identity Token.
Q: What is the difference between an identity token and a reference token?
A: An identity token is a JSON Web Token scoped to one user's permissions. A reference token is a short string that points to that token, and it starts with cmVmd. For more information, see Understanding Identity Tokens.
Q: What happens to identity tokens when a user is deleted or disabled?
A: The identity tokens for that user are revoked. For more information, see Generate an Identity Token.
Q: How do reference tokens differ from API keys?
A: You can create more than one reference token, and the token can expire. Reference tokens are stored as a hash, so they can't be retrieved, while API keys don't expire and can be retrieved from a database. For more information, see Comparing Identity Reference Tokens With API Keys.
Q: Can I revoke an identity token?
A: Yes. In your profile, click the x on the token row, and then click Revoke. For more information, see Revoke an Identity Token.
Related Topics
Updated 9 days ago
