1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-18 09:13:28 +00:00

CLI support for SSO Login (#57)

* sso login support

* fix build and lint issues

* allow web vault URL to be set
This commit is contained in:
Kyle Spearrin
2020-08-04 14:19:53 -04:00
committed by GitHub
parent fb122cbbdb
commit 2b2d8a9fab
10 changed files with 59 additions and 9 deletions

View File

@@ -86,6 +86,7 @@ export class Program extends BaseProgram {
.description('Log into a user account.')
.option('--method <method>', 'Two-step login method.')
.option('--code <code>', 'Two-step login code.')
.option('--sso', 'Log in with Single-Sign On.')
.on('--help', () => {
writeLn('\n Notes:');
writeLn('');
@@ -96,11 +97,14 @@ export class Program extends BaseProgram {
writeLn(' bw login');
writeLn(' bw login john@example.com myPassword321');
writeLn(' bw login john@example.com myPassword321 --method 1 --code 249213');
writeLn(' bw login --sso');
writeLn('', true);
})
.action(async (email: string, password: string, cmd: program.Command) => {
await this.exitIfAuthed();
const command = new LoginCommand(this.main.authService, this.main.apiService, this.main.i18nService);
const command = new LoginCommand(this.main.authService, this.main.apiService, this.main.i18nService,
this.main.environmentService, this.main.passwordGenerationService, this.main.cryptoFunctionService,
'connector');
const response = await command.run(email, password, cmd);
this.processResponse(response);
});