forked from heroku/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move authorizations, clients, and sessions commands from oa…
…uth to cli (heroku#2419) * test: add test to oauth authorizations * refactor: add destroy alias to authorizations:revoke in oauth * refactor: move authorizations commands, helper, and tests to cli * refactor: move clients commands, helper, and tests to cli * refactor: organize and alphabetize smoke tests * test: add smoke test for heroku clients command * refactor: move sessions commands and tests to cli * test: add smoke test for heroku sessions command * refactor: remove oauth-v5 from cli and update topics * refactor: remove oauth package * fix: change alias names for authorizations:revoke * tests: fix smoke tests and unskip test that might be fixed
- Loading branch information
Showing
49 changed files
with
287 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 8 additions & 4 deletions
12
...uth/src/commands/authorizations/revoke.ts → ...cli/src/commands/authorizations/revoke.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,30 @@ | ||
import color from '@heroku-cli/color' | ||
import {Command} from '@heroku-cli/command' | ||
import * as Heroku from '@heroku-cli/schema' | ||
import {CliUx} from '@oclif/core' | ||
import {Args, ux} from '@oclif/core' | ||
|
||
export default class AuthorizationsRevoke extends Command { | ||
static description = 'revoke OAuth authorization' | ||
|
||
static aliases = ['authorizations:revoke', 'authorizations:destroy'] | ||
|
||
static examples = [ | ||
'$ heroku authorizations:revoke 105a7bfa-34c3-476e-873a-b1ac3fdc12fb', | ||
] | ||
|
||
static args = [{name: 'id', required: true}] | ||
static args = { | ||
id: Args.string({required: true}), | ||
} | ||
|
||
async run() { | ||
const {args} = await this.parse(AuthorizationsRevoke) | ||
|
||
CliUx.ux.action.start('Revoking OAuth Authorization') | ||
ux.action.start('Revoking OAuth Authorization') | ||
|
||
const {body: auth} = await this.heroku.delete<Heroku.OAuthAuthorization>( | ||
`/oauth/authorizations/${encodeURIComponent(args.id)}`, | ||
) | ||
|
||
CliUx.ux.action.stop(`done, revoked authorization from ${color.cyan(auth.description)}`) | ||
ux.action.stop(`done, revoked authorization from ${color.cyan(auth.description)}`) | ||
} | ||
} |
12 changes: 7 additions & 5 deletions
12
...uth/src/commands/authorizations/rotate.ts → ...cli/src/commands/authorizations/rotate.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 6 additions & 4 deletions
10
...ges/oauth/src/commands/clients/destroy.ts → packages/cli/src/commands/clients/destroy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,24 @@ | ||
import color from '@heroku-cli/color' | ||
import {Command} from '@heroku-cli/command' | ||
import * as Heroku from '@heroku-cli/schema' | ||
import {CliUx} from '@oclif/core' | ||
import {Args, ux} from '@oclif/core' | ||
|
||
export default class ClientsDestroy extends Command { | ||
static description = 'delete client by ID' | ||
|
||
static args = [{name: 'id', required: true}] | ||
static args = { | ||
id: Args.string({required: true}), | ||
} | ||
|
||
async run() { | ||
const {args} = await this.parse(ClientsDestroy) | ||
|
||
CliUx.ux.action.start(`Destroying ${color.cyan(args.id)}`) | ||
ux.action.start(`Destroying ${color.cyan(args.id)}`) | ||
|
||
await this.heroku.delete<Heroku.OAuthClient>( | ||
`/oauth/clients/${args.id}`, | ||
) | ||
|
||
CliUx.ux.action.stop() | ||
ux.action.stop() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.