Skip to content

Commit

Permalink
feat: sf-ify plugin-auth (#604)
Browse files Browse the repository at this point in the history
* feat: sf-ify plugin-auth

@W-12083545@

* chore: replace sfdx command with sf command

* chore: fix compilation errors in tests

* feat: sf-ify

* chore: fixup unit tests

* chore: update schema

* chore: fix messages/code for help and flag names

* chore: adjust messges to provide config.bin

* chore: fix nuts

* chore: increate test timeout to 10 seconds

* chore: apply review comments

* Update messages/sfdxurl.store.md

Co-authored-by: Cristian Dominguez <6853656+cristiand391@users.noreply.github.com>

* chore: apply changes from review

* chore: qa review fixes

* chore: fix logout nut test

* chore: deprecate aliases

* chore: log code and url as json

* chore: bump sf-plugins-core

* chore: set default to false for run logout

---------

Co-authored-by: Cristian Dominguez <6853656+cristiand391@users.noreply.github.com>
  • Loading branch information
peternhale and cristiand391 authored Feb 10, 2023
1 parent 7b26203 commit b303fce
Show file tree
Hide file tree
Showing 53 changed files with 3,097 additions and 2,852 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
module.exports = {
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license'],
extends: ['eslint-config-salesforce-typescript', 'eslint-config-salesforce-license', 'plugin:sf-plugin/recommended'],
};
2 changes: 1 addition & 1 deletion .mocharc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"watch-extensions": "ts",
"recursive": true,
"reporter": "spec",
"timeout": 5000
"timeout": 10000
}
445 changes: 96 additions & 349 deletions CHANGELOG.md

Large diffs are not rendered by default.

64 changes: 24 additions & 40 deletions command-snapshot.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,37 @@
{
"command": "auth:accesstoken:store",
"plugin": "@salesforce/plugin-auth",
"flags": [
"instanceurl",
"json",
"loglevel",
"noprompt",
"setalias",
"setdefaultdevhubusername",
"setdefaultusername"
],
"flags": ["alias", "instance-url", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub"],
"alias": ["force:auth:accesstoken:store"]
},
{
"command": "auth:device:login",
"plugin": "@salesforce/plugin-auth",
"flags": [
"clientid",
"disablemasking",
"instanceurl",
"alias",
"client-id",
"disable-masking",
"instance-url",
"json",
"loglevel",
"setalias",
"setdefaultdevhubusername",
"setdefaultusername"
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:device:login"]
},
{
"command": "auth:jwt:grant",
"plugin": "@salesforce/plugin-auth",
"flags": [
"clientid",
"instanceurl",
"alias",
"client-id",
"instance-url",
"json",
"jwtkeyfile",
"jwt-key-file",
"loglevel",
"noprompt",
"setalias",
"setdefaultdevhubusername",
"setdefaultusername",
"no-prompt",
"set-default",
"set-default-dev-hub",
"username"
],
"alias": ["force:auth:jwt:grant"]
Expand All @@ -54,37 +46,29 @@
{
"command": "auth:logout",
"plugin": "@salesforce/plugin-auth",
"flags": ["all", "apiversion", "json", "loglevel", "noprompt", "targetusername"],
"flags": ["all", "json", "loglevel", "no-prompt", "target-org"],
"alias": ["force:auth:logout"]
},
{
"command": "auth:sfdxurl:store",
"plugin": "@salesforce/plugin-auth",
"flags": [
"json",
"loglevel",
"noprompt",
"setalias",
"setdefaultdevhubusername",
"setdefaultusername",
"sfdxurlfile"
],
"flags": ["alias", "json", "loglevel", "no-prompt", "set-default", "set-default-dev-hub", "sfdx-url-file"],
"alias": ["force:auth:sfdxurl:store"]
},
{
"command": "auth:web:login",
"plugin": "@salesforce/plugin-auth",
"flags": [
"clientid",
"disablemasking",
"instanceurl",
"alias",
"browser",
"client-id",
"disable-masking",
"instance-url",
"json",
"loglevel",
"noprompt",
"setalias",
"setdefaultdevhubusername",
"setdefaultusername",
"browser"
"no-prompt",
"set-default",
"set-default-dev-hub"
],
"alias": ["force:auth:web:login"]
}
Expand Down
9 changes: 0 additions & 9 deletions messages/accesstoken.store.json

This file was deleted.

22 changes: 22 additions & 0 deletions messages/accesstoken.store.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# summary

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

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

- $ export SFDX_ACCESS_TOKEN=00Dxx0000000000!xxxxx

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

# invalidAccessTokenFormat

The access token isn't in the correct format.
It should follow this pattern: %s.
11 changes: 0 additions & 11 deletions messages/device.login.json

This file was deleted.

28 changes: 28 additions & 0 deletions messages/device.login.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# summary

authorize an org using a device code

# description

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

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

- $ <%= config.bin %> <%= command.id %> -i <OAuth client id>

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

# actionRequired

Action Required!

# enterCode

Enter %s user code in the verification URL %s

# success

Login successful for %s. You can now close the browser.
11 changes: 0 additions & 11 deletions messages/jwt.grant.json

This file was deleted.

29 changes: 29 additions & 0 deletions messages/jwt.grant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# summary

authorize an org using the JWT flow

# description

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

- $ <%= config.bin %> <%= command.id %> -o me@my.org -f <path to jwt key file> -i <OAuth client id>

- $ <%= 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 %> -o me@acme.org -f <path to jwt key file> -i <OAuth client id> -r https://acme.my.salesforce.com

# username

authentication username

# key

path to a file containing the private key

# JwtGrantError

We encountered a JSON web token error, which is likely not an issue with Salesforce CLI. Here’s the error: %s
4 changes: 0 additions & 4 deletions messages/list.json

This file was deleted.

15 changes: 15 additions & 0 deletions messages/list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# summary

List auth connection information

# description

list auth connection information

# examples

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

# noResultsFound

No results found
9 changes: 0 additions & 9 deletions messages/logout.json

This file was deleted.

45 changes: 45 additions & 0 deletions messages/logout.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# summary

log out from authorized orgs

# description

log out from authorized orgs
By default, this command logs you out from your default scratch org.

# examples

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

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

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

# flags.target-org.summary

Username or alias of the target org.

# all

include all authenticated orgs

# allLong

Includes all authenticated orgs: for example, Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.

# logoutCommandYesNo

Are you sure you want to log out from these org(s)?
%s

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.

Log out?

# logoutOrgCommandSuccess

Successfully logged out of orgs: %s

# logoutOrgCommandNoOrgsFound

No orgs found to log out of.
37 changes: 0 additions & 37 deletions messages/messages.json

This file was deleted.

Loading

0 comments on commit b303fce

Please sign in to comment.