Skip to content

Commit

Permalink
Merge pull request #627 from salesforcecli/revert-616-phale/restructu…
Browse files Browse the repository at this point in the history
…re-auth

Revert "feat: restructure plugin-auth"
  • Loading branch information
mshanemc authored Feb 21, 2023
2 parents fdb40ee + 3cf0b8e commit abf4e61
Show file tree
Hide file tree
Showing 39 changed files with 1,064 additions and 1,427 deletions.
44 changes: 22 additions & 22 deletions command-snapshot.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
[
{
"command": "org:list:auth",
"plugin": "@salesforce/plugin-auth",
"flags": ["json", "loglevel"],
"alias": ["force:auth:list", "auth:list"]
},
{
"command": "org:login:access-token",
"command": "auth:accesstoken:store",
"plugin": "@salesforce/plugin-auth",
"flags": ["alias", "instance-url", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub"],
"alias": ["force:auth:accesstoken:store", "auth:accesstoken:store"]
"alias": ["force:auth:accesstoken:store"]
},
{
"command": "org:login:device",
"command": "auth:device:login",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -24,10 +18,10 @@
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:device:login", "auth:device:login"]
"alias": ["force:auth:device:login"]
},
{
"command": "org:login:jwt",
"command": "auth:jwt:grant",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -41,16 +35,28 @@
"set-default-dev-hub",
"username"
],
"alias": ["force:auth:jwt:grant", "auth:jwt:grant"]
"alias": ["force:auth:jwt:grant"]
},
{
"command": "auth:list",
"plugin": "@salesforce/plugin-auth",
"flags": ["json", "loglevel"],
"alias": ["force:auth:list"]
},
{
"command": "org:login:sfdx-url",
"command": "auth:logout",
"plugin": "@salesforce/plugin-auth",
"flags": ["all", "json", "loglevel", "no-prompt", "target-org"],
"alias": ["force:auth:logout"]
},
{
"command": "auth:sfdxurl:store",
"plugin": "@salesforce/plugin-auth",
"flags": ["alias", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub", "sfdx-url-file"],
"alias": ["force:auth:sfdxurl:store", "auth:sfdxurl:store"]
"alias": ["force:auth:sfdxurl:store"]
},
{
"command": "org:login:web",
"command": "auth:web:login",
"plugin": "@salesforce/plugin-auth",
"flags": [
"alias",
Expand All @@ -64,12 +70,6 @@
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:web:login", "auth:web:login"]
},
{
"command": "org:logout",
"plugin": "@salesforce/plugin-auth",
"flags": ["all", "json", "loglevel", "no-prompt", "target-org"],
"alias": ["force:auth:logout", "auth:logout"]
"alias": ["force:auth:web:login"]
}
]
12 changes: 5 additions & 7 deletions messages/accesstoken.store.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
# summary

Authorize an org using an existing Salesforce access token.
authorize an org using an existing Salesforce access token

# description

authorize an org using an existing Salesforce access token
By default, the command runs interactively and asks you for the access token. If you previously authorized the org, the command prompts whether you want to overwrite the local file. Specify --no-prompt to not be prompted.

To use the command in a CI/CD script, set the SFDX_ACCESS_TOKEN environment variable to the access token. Then run the command with the --no-prompt parameter.

# examples

- Authorize an org on https://mycompany.my.salesforce.com; the command prompts you for the access token:

<%= config.bin %> <%= command.id %> --instance-url https://mycompany.my.salesforce.com
- $ <%= config.bin %> <%= command.id %> --instance-url https://mycompany.my.salesforce.com

- Authorize the org without being prompted; you must have previously set the SFDX_ACCESS_TOKEN environment variable to the access token:
- $ export SFDX_ACCESS_TOKEN=00Dxx0000000000!xxxxx

<%= config.bin %> <%= command.id %> --instance-url https://dev-hub.my.salesforce.com --no-prompt
- $ <%= config.bin %> <%= command.id %> --instance-url https://dev-hub.my.salesforce.com --no-prompt

# invalidAccessTokenFormat

Expand Down
21 changes: 7 additions & 14 deletions messages/device.login.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
# summary

Authorize an org using a device code.
authorize an org using a device code

# description

Use this command to allow a device to connect to an org.

When you run this command, it first displays an 8-digit device code and the URL for verifying the code on your org. The default instance URL is https://login.salesforce.com, so if the org you're authorizing is on a different instance, use the --instance-url. The command waits while you complete the verification. Open a browser and navigate to the displayed verification URL, enter the code, then click Connect. If you aren't already logged into your org, log in, and then you're prompted to allow the device to connect to the org. After you successfully authorize the org, you can close the browser window.
authorize an org using a device code
You must open a browser, navigate to the verification URL, and enter the code. Log in, if not already logged in, and you’ll be prompted to allow the device to connect to the org.

# examples

- Authorize an org using a device code, give the org the alias TestOrg1, and set it as your default Dev Hub org:

<%= config.bin %> <%= command.id %> --set-default-dev-hub --alias TestOrg1

- Authorize an org in which you've created a custom connected app with the specified client ID (consumer key):

<%= config.bin %> <%= command.id %> --client-id <OAuth client id>
- $ <%= config.bin %> <%= command.id %> -d -a TestOrg1

- Authorize a sandbox org with the specified instance URL:
- $ <%= config.bin %> <%= command.id %> -i <OAuth client id>

<%= config.bin %> <%= command.id %> --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com
- $ <%= config.bin %> <%= command.id %> -r https://MyDomainName--SandboxName.sandbox.my.salesforce.com

# actionRequired

Action Required!

# enterCode

Enter %s device code in this verification URL: %s
Enter %s user code in the verification URL %s

# success

Expand Down
42 changes: 11 additions & 31 deletions messages/jwt.grant.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,28 @@
# summary

Log in to a Salesforce org using a JSON web token (JWT).
authorize an org using the JWT flow

# description

Use this command in automated environments where you can’t interactively log in with a browser, such as in CI/CD scripts.

Logging into an org authorizes the CLI to run other commands that connect to that org, such as deploying or retrieving a project. You can log into many types of orgs, such as sandboxes, Dev Hubs, Env Hubs, production orgs, and scratch orgs.

Complete these steps before you run this command:

1. Create a digital certificate (also called digital signature) and the private key to sign the certificate. You can use your own key and certificate issued by a certification authority. Or use OpenSSL to create a key and a self-signed digital certificate.
2. Store the private key in a file on your computer. When you run this command, you set the --jwt-key-file flag to this file.
3. Create a custom connected app in your org using the digital certificate. Make note of the consumer key (also called client id) that’s generated for you. Be sure the username of the user logging in is approved to use the connected app. When you run this command, you set the --client-id flag to the consumer key.

See https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_auth_jwt_flow.htm for more information.

We recommend that you set an alias when you log into an org. Aliases make it easy to later reference this org when running commands that require it. If you don’t set an alias, you use the username that you specified when you logged in to the org. If you run multiple commands that reference the same org, consider setting the org as your default. Use --set-default for your default scratch org or sandbox, or --set-default-dev-hub for your default Dev Hub.
authorize an org using the JWT flow
Use a certificate associated with your private key that has been uploaded to a personal connected app.
If you specify an --instanc-eurl value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file. To specify a My Domain URL, use the format MyDomainName.my.salesforce.com (not MyDomainName.lightning.force.com). To specify a sandbox, set --instance-url to https://MyDomainName--SandboxName.sandbox.my.salesforce.com.

# examples

- Log into an org with username jdoe@example.org and on the default instance URL (https://login.salesforce.org). The private key is stored in the file /Users/jdoe/JWT/server.key and the command uses the connected app with consumer key (client id) 04580y4051234051.

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051

- Set the org as the default and give it an alias:

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-org --set-default

- Set the org as the default Dev Hub and give it an alias:

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-dev-hub --set-default-dev-hub
- $ <%= config.bin %> <%= command.id %> -o me@my.org -f <path to jwt key file> -i <OAuth client id>

- Log in to a sandbox using URL https://MyDomainName--SandboxName.sandbox.my.salesforce.com:
- $ <%= config.bin %> <%= command.id %> -o me@my.org -f <path to jwt key file> -i <OAuth client id> -s -a MyDefaultOrg

<%= config.bin %> <%= command.id %> --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 04580y4051234051 --alias ci-org --set-default --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com
- $ <%= config.bin %> <%= command.id %> -o me@acme.org -f <path to jwt key file> -i <OAuth client id> -r https://acme.my.salesforce.com

# flags.username.summary
# username

Username of the user logging in.
authentication username

# flags.jwt-key-file.summary
# key

Path to a file containing the private key.
path to a file containing the private key

# JwtGrantError

Expand Down
10 changes: 4 additions & 6 deletions messages/list.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# summary

List authorization information about the orgs you created or logged into.
List auth connection information

# description

This command uses local authorization information that Salesforce CLI caches when you create a scratch org or log into an org. The command doesn't actually connect to the orgs to verify that they're still active. As a result, this command executes very quickly. If you want to view live information about your authorized orgs, such as their connection status, use the "org list" command.
list auth connection information

# examples

- List local authorization information about your orgs:

<%= config.bin %> <%= command.id %>
- $ <%= config.bin %> <%= command.id %>

# noResultsFound

No results found.
No results found
72 changes: 18 additions & 54 deletions messages/logout.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,45 @@
# summary

Log out of a Salesforce org.
log out from authorized orgs

# description

If you run this command with no flags, it first displays a list of orgs you've created or logged into, with none of the orgs selected. Use the arrow keys to scroll through the list and the space bar to select the orgs you want to log out of. Press Enter when you're done; the command asks for a final confirmation before logging out of the selected orgs.

The process is similar if you specify --all, except that in the initial list of orgs, they're all selected. Use --target-org to logout of a specific org. In both these cases by default, you must still confirm that you want to log out. Use --no-prompt to never be asked for confirmation when also using --all or --target-org.

Be careful! If you log out of a scratch org without having access to its password, you can't access the scratch org again, either through the CLI or the Salesforce UI.
log out from authorized orgs
By default, this command logs you out from your default scratch org.

# examples

- Interactively select the orgs to log out of:

<%= config.bin %> <%= command.id %>
- $ <%= config.bin %> <%= command.id %> -o me@my.org

- Log out of the org with username me@my.org:
- $ <%= config.bin %> <%= command.id %> -a

<%= config.bin %> <%= command.id %> --target-org me@my.org
- $ <%= config.bin %> <%= command.id %> -p

- Log out of all orgs after confirmation:
# flags.target-org.summary

<%= config.bin %> <%= command.id %> --all
Username or alias of the target org.

- Logout of the org with alias my-scratch and don't prompt for confirmation:
# all

<%= config.bin %> <%= command.id %> --target-org my-scratch --no-prompt
include all authenticated orgs

# flags.target-org.summary
# allLong

Username or alias of the target org.
Includes all authenticated orgs: for example, Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.

# flags.all.summary
# logoutCommandYesNo

Include all authenticated orgs.
Are you sure you want to log out from these org(s)?
%s

# flags.all.description
Important: You need a password to reauthorize scratch orgs. By default, scratch orgs have no password. If you still need your scratch orgs, run "%s org:generate:password" before logging out. If you don't need the scratch orgs anymore, run "%s org:delete:scratch" or "%s org:delete:sandbox"instead of logging out.

All orgs includes Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.
Log out?

# logoutOrgCommandSuccess

Successfully logged out of orgs: %s

# noOrgsFound
# logoutOrgCommandNoOrgsFound

No orgs found to log out of.

# noOrgsSelected

No orgs selected for logout.

# prompt.select-envs

Select the orgs you want to log out of:

# prompt.confirm

Are you sure you want to log out of %d org%s?

# prompt.confirm-all

Are you sure you want to log out of all your orgs?

# prompt.confirm.single

Are you sure you want to log out of %s?

# warning

Warning: If you log out of a scratch org without having access to its password, you can't access this org again, either through the CLI or the Salesforce UI.

# noOrgSpecifiedWithNoPrompt

You must specify a target-org (or default target-org config is set) or use --all flag when using the --no-prompt flag.

# noOrgSpecifiedWithJson

You must specify a target-org (or default target-org config is set) or use --all flag when using the --json flag.
38 changes: 15 additions & 23 deletions messages/messages.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,40 @@
# flags.client-id.summary
# clientId

OAuth client ID (also called consumer key) of your custom connected app.
OAuth client ID (sometimes called the consumer key)

# flags.set-default-dev-hub.summary
# setDefaultDevHub

Set the authenticated org as the default Dev Hub.
set the authenticated org as the default dev hub org for scratch org creation

# flags.set-default.summary
# setDefaultUsername

Set the authenticated org as the default that all org-related commands run against.
set the authenticated org as the default username that all commands run against

# flags.alias.summary
# setAlias

Alias for the org.
set an alias for the authenticated org

# flags.instance-url.summary
# instanceUrl

URL of the instance that the org lives on.

# flags.instance-url.description

If you specify an --instance-url value, this value overrides the sfdcLoginUrl value in your sfdx-project.json file.

To specify a My Domain URL, use the format https://yourcompanyname.my.salesforce.com.

To specify a sandbox, set --instance-url to https://MyDomainName--SandboxName.sandbox.my.salesforce.com.
the login URL of the instance the org lives on

# authorizeCommandSuccess

Successfully authorized %s with org ID %s

# warnAuth

Logging in to a business or production org is not recommended on a demo or shared machine. Please run "%s org:logout --target-org <your username> --no-prompt" when finished using this org, which is similar to logging out of the org in the browser.
Logging in to a business or production org is not recommended on a demo or shared machine. Please run "%s auth:logout --target-org <your username> --no-prompt" when finished using this org, which is similar to logging out of the org in the browser.

Do you want to authorize this org for use with the Salesforce CLI?

# flags.no-prompt.summary
# noPromptAuth

Don't prompt for confirmation.
do not prompt for auth confirmation in demo mode

# flags.disable-masking.summary
# disableMasking

Disable masking of user input; use with problematic terminals.
disable masking of user input (for use with problematic terminals)

# clientSecretStdin

Expand Down
Loading

0 comments on commit abf4e61

Please sign in to comment.