Skip to content

Commit

Permalink
Add 'jf atc' command (#103)
Browse files Browse the repository at this point in the history
  • Loading branch information
yahavi authored Mar 15, 2024
1 parent 578d70d commit d72e412
Showing 1 changed file with 44 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,54 @@ This command is solely interactive, meaning it does not receive any options and
![](../../../.gitbook/assets/login-page.png)
![](../../../.gitbook/assets/login-successful.png)

## Creating Access Tokens

This command allows creating [Access Tokens](https://jfrog.com/help/r/jfrog-platform-administration-documentation/access-tokens) for users in the JFrog Platform. By default, an user-scoped token will be created. Administrators may provide the scope explicitly with '--scope', or implicitly with '--groups', '--grant-admin'.

### Commands Params

| | |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Command name | access-token-create |
| Abbreviation | atc |
| Command arguments | |
| username | The username for which this token is created. If not specified, the token will be created for the current user. |
| Command options | |
| --audience | <p>[Optional]</p><p>A space-separated list of the other instances or services that should accept this token identified by their Service-IDs.</p> |
| --description | <p>[Optional]</p><p>Free text token description. Useful for filtering and managing tokens. Limited to 1024 characters.</p> |
| --expiry | <p>[Optional]</p><p>The amount of time, in seconds, it would take for the token to expire. Must be non-negative. If not provided, the platform default will be used. To specify a token that never expires, set to zero. Non-admin may only set a value that is equal or lower than the platform default that was set by an administrator (1 year by default).</p> |
| --grant-admin | <p>[Default: false]</p><p>Set to true to provide admin privileges to the access token. This is only available for administrators.</p> |
| --groups | <p>[Optional]</p><p>A list of comma-separated groups for the access token to be associated with. This is only available for administrators.</p> |
| --project | <p>[Optional]</p><p>The project for which this token is created. Enter the project name on which you want to apply this token.</p> |
| --reference | <p>[Default: false]</p><p>Generate a Reference Token (alias to Access Token) in addition to the full token (available from Artifactory 7.38.10).</p> |
| --refreshable | <p>[Default: false]</p><p>Set to true if you'd like the token to be refreshable. A refresh token will also be returned in order to be used to generate a new token once it expires.</p> |
| --scope | <p>[Optional]</p><p>The scope of access that the token provides. This is only available for administrators.</p> |

### Examples

#### Example 1

Create an access token for the user in the default server configured by the [jf c add](#adding-and-editing-configured-servers) command:

```
jf atc
```

#### Example 2

Create an access token for the user with the **toad** username:

```
jf atc toad
```

## Adding and Editing Configured Servers

The **config add** and **config edit** commands are used to add and edit JFrog Platform server configuration, stored in JFrog CLI's configuration storage. These configured servers can be used by the other commands. The configured servers' details can be overridden per command by passing in alternative values for the URL and login credentials. The values configured are saved in file under the JFrog CLI home directory.

| | |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Command Name | Config Add/ Config Edit |
| Command Name | config add / config edit |
| Abbreviation | c add / c edit |
| Command options | |
| --access-token | <p>[Optional]</p><p>Access token.</p> |
Expand Down Expand Up @@ -99,7 +140,7 @@ The _config export_ command generates a token, which stores the server configura

Starting from version 1.37.0, JFrog CLI introduces support for encrypting sensitive data stored in its configuration using an encryption key stored in a file. Follow these steps to enable encryption:

1. Generate a random 32-character master key. Ensure that the key size is exactly 32 characters. For example: *f84hc22dQfhe9f8ydFwfsdn48!wejh8A*
1. Generate a random 32-character master key. Ensure that the key size is exactly 32 characters. For example: _f84hc22dQfhe9f8ydFwfsdn48!wejh8A_
2. Create a file named **security.yaml** under **~/.jfrog/security**.

> If you've customized the default JFrog CLI home directory by setting the JFROG_CLI_HOME_DIR environment variable, create the **security/security.yaml** file under the configured home directory.
Expand All @@ -121,7 +162,7 @@ The configuration will be encrypted the next time JFrog CLI accesses the config.
Starting from version 2.36.0, JFrog CLI also supports encrypting sensitive data in its configuration using an encryption key stored in an environment variable. To enable encryption, follow these steps:
1. Generate a random 32-character master key. Ensure that the key size is exactly 32 characters. For example: *f84hc22dQfhe9f8ydFwfsdn48!wejh8A*
1. Generate a random 32-character master key. Ensure that the key size is exactly 32 characters. For example: _f84hc22dQfhe9f8ydFwfsdn48!wejh8A_
2. Store the key in an environment variable named **JFROG_CLI_ENCRYPTION_KEY**.
The configuration will be encrypted the next time JFrog CLI attempts to access the config. If you have configurations already stored before setting the environment variable, you'll need to reconfigure the servers stored in the config.

0 comments on commit d72e412

Please sign in to comment.