@signageos/cli 1.3.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +3 -0
- package/dist/Auth/loginCommand.d.ts +10 -2
- package/dist/Auth/loginCommand.js +38 -18
- package/dist/Auth/loginCommand.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,13 @@ All notable changes to this project will be documented in this file.
|
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.4.0] - 2023-09-25
|
|
8
|
+
### Added
|
|
9
|
+
- Update readme
|
|
10
|
+
- Auth0 compatibility
|
|
11
|
+
|
|
7
12
|
## [1.3.1] - 2023-08-29
|
|
13
|
+
|
|
8
14
|
## [1.3.0] - 2023-05-19
|
|
9
15
|
### Fixed
|
|
10
16
|
- New version announcement has a link to the changelog
|
package/README.md
CHANGED
|
@@ -29,6 +29,9 @@ npm run test-integration
|
|
|
29
29
|
| --profile *(optional)* | Profile used for separation of credentials and other configurations set in the `~/.sosrc` file | ${SOS_PROFILE} |
|
|
30
30
|
|
|
31
31
|
### Login
|
|
32
|
+
#### Requirements
|
|
33
|
+
- Active account. It can be obtained by manual sign-up in [https://box.signageos.io](https://box.signageos.io)
|
|
34
|
+
|
|
32
35
|
```bash
|
|
33
36
|
sos login
|
|
34
37
|
```
|
|
@@ -5,10 +5,18 @@ declare const OPTION_LIST: readonly [{
|
|
|
5
5
|
readonly description: `Username or e-mail used for ${string}`;
|
|
6
6
|
}];
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* To explicitly enable auth0 authentication add flag --auth0-enabled to command line options
|
|
9
9
|
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
10
|
+
*
|
|
11
|
+
* To explicitly enable legacy authentication add flag --legacy-enabled to command line options
|
|
12
|
+
* { _unknown: [ '--legacy-enabled' ], command: [ 'login' ] }
|
|
13
|
+
*
|
|
14
|
+
* Only one from auth0 and legacy authentication can be active at the moment
|
|
10
15
|
*/
|
|
11
|
-
export declare const
|
|
16
|
+
export declare const getIsAuth0OrLegacyEnabled: (options: any) => {
|
|
17
|
+
isAuth0Enabled: boolean;
|
|
18
|
+
isLegacyEnabled: boolean;
|
|
19
|
+
};
|
|
12
20
|
export declare const login: {
|
|
13
21
|
name: "login";
|
|
14
22
|
description: string;
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.login = exports.
|
|
39
|
+
exports.login = exports.getIsAuth0OrLegacyEnabled = void 0;
|
|
40
40
|
var chalk_1 = require("chalk");
|
|
41
41
|
var prompts = require("prompts");
|
|
42
42
|
var Debug = require("debug");
|
|
@@ -51,19 +51,32 @@ var commandDefinition_1 = require("../Command/commandDefinition");
|
|
|
51
51
|
var debug = Debug('@signageos/cli:Auth:login');
|
|
52
52
|
var OPTION_LIST = [{ name: 'username', type: String, description: "Username or e-mail used for ".concat(parameters_1.parameters.boxHost) }];
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
54
|
+
* To explicitly enable auth0 authentication add flag --auth0-enabled to command line options
|
|
55
55
|
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
56
|
+
*
|
|
57
|
+
* To explicitly enable legacy authentication add flag --legacy-enabled to command line options
|
|
58
|
+
* { _unknown: [ '--legacy-enabled' ], command: [ 'login' ] }
|
|
59
|
+
*
|
|
60
|
+
* Only one from auth0 and legacy authentication can be active at the moment
|
|
56
61
|
*/
|
|
57
|
-
var
|
|
58
|
-
var _a;
|
|
62
|
+
var getIsAuth0OrLegacyEnabled = function (options) {
|
|
63
|
+
var _a, _b;
|
|
59
64
|
var isAuth0Enabled = false;
|
|
65
|
+
var isLegacyEnabled = false;
|
|
60
66
|
// tslint:disable-next-line no-string-literal
|
|
61
67
|
if ((_a = options['_unknown']) === null || _a === void 0 ? void 0 : _a.includes('--auth0-enabled')) {
|
|
62
68
|
isAuth0Enabled = true;
|
|
63
69
|
}
|
|
64
|
-
|
|
70
|
+
// tslint:disable-next-line no-string-literal
|
|
71
|
+
if ((_b = options['_unknown']) === null || _b === void 0 ? void 0 : _b.includes('--legacy-enabled')) {
|
|
72
|
+
isLegacyEnabled = true;
|
|
73
|
+
}
|
|
74
|
+
if (isAuth0Enabled && isLegacyEnabled) {
|
|
75
|
+
throw new Error('Only one override from auth0 and legacy authentication options can be active at the moment.');
|
|
76
|
+
}
|
|
77
|
+
return { isAuth0Enabled: isAuth0Enabled, isLegacyEnabled: isLegacyEnabled };
|
|
65
78
|
};
|
|
66
|
-
exports.
|
|
79
|
+
exports.getIsAuth0OrLegacyEnabled = getIsAuth0OrLegacyEnabled;
|
|
67
80
|
exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
68
81
|
name: 'login',
|
|
69
82
|
description: 'Login account using username & password',
|
|
@@ -71,9 +84,9 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
71
84
|
commands: [],
|
|
72
85
|
run: function (options) {
|
|
73
86
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var identification, response, password, config, apiUrl, isAuth0Enabled,
|
|
75
|
-
return __generator(this, function (
|
|
76
|
-
switch (
|
|
87
|
+
var identification, response, password, config, apiUrl, _a, isAuth0Enabled, isLegacyEnabled, _b, tokenId, apiSecurityToken, name;
|
|
88
|
+
return __generator(this, function (_c) {
|
|
89
|
+
switch (_c.label) {
|
|
77
90
|
case 0:
|
|
78
91
|
identification = options.username;
|
|
79
92
|
if (!!identification) return [3 /*break*/, 2];
|
|
@@ -83,9 +96,9 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
83
96
|
message: "Type your username or e-mail used for ".concat(parameters_1.parameters.boxHost),
|
|
84
97
|
})];
|
|
85
98
|
case 1:
|
|
86
|
-
response =
|
|
99
|
+
response = _c.sent();
|
|
87
100
|
identification = response.username;
|
|
88
|
-
|
|
101
|
+
_c.label = 2;
|
|
89
102
|
case 2:
|
|
90
103
|
if (!identification) {
|
|
91
104
|
throw new Error('Missing argument --username <string>');
|
|
@@ -96,22 +109,28 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
96
109
|
message: "Type your password used for ".concat(parameters_1.parameters.boxHost),
|
|
97
110
|
})];
|
|
98
111
|
case 3:
|
|
99
|
-
password = (
|
|
112
|
+
password = (_c.sent()).password;
|
|
100
113
|
return [4 /*yield*/, (0, runControlHelper_1.loadConfig)()];
|
|
101
114
|
case 4:
|
|
102
|
-
config =
|
|
115
|
+
config = _c.sent();
|
|
103
116
|
apiUrl = (0, helper_1.getApiUrl)(config);
|
|
104
|
-
|
|
105
|
-
return [4 /*yield*/, getOrCreateApiSecurityToken({
|
|
117
|
+
_a = (0, exports.getIsAuth0OrLegacyEnabled)(options), isAuth0Enabled = _a.isAuth0Enabled, isLegacyEnabled = _a.isLegacyEnabled;
|
|
118
|
+
return [4 /*yield*/, getOrCreateApiSecurityToken({
|
|
119
|
+
identification: identification,
|
|
120
|
+
password: password,
|
|
121
|
+
apiUrl: apiUrl,
|
|
122
|
+
isAuth0Enabled: isAuth0Enabled,
|
|
123
|
+
isLegacyEnabled: isLegacyEnabled,
|
|
124
|
+
})];
|
|
106
125
|
case 5:
|
|
107
|
-
|
|
126
|
+
_b = _c.sent(), tokenId = _b.id, apiSecurityToken = _b.securityToken, name = _b.name;
|
|
108
127
|
return [4 /*yield*/, (0, runControlHelper_1.saveConfig)({
|
|
109
128
|
apiUrl: apiUrl !== parameters_1.parameters.apiUrl ? apiUrl : undefined,
|
|
110
129
|
identification: tokenId,
|
|
111
130
|
apiSecurityToken: apiSecurityToken,
|
|
112
131
|
})];
|
|
113
132
|
case 6:
|
|
114
|
-
|
|
133
|
+
_c.sent();
|
|
115
134
|
(0, log_1.log)('info', "User ".concat(chalk_1.default.green(identification), " has been logged in with token \"").concat(name, "\". Credentials are stored in ").concat(chalk_1.default.blue((0, sosControlHelper_1.getConfigFilePath)())));
|
|
116
135
|
return [2 /*return*/];
|
|
117
136
|
}
|
|
@@ -120,7 +139,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
120
139
|
},
|
|
121
140
|
});
|
|
122
141
|
function getOrCreateApiSecurityToken(_a) {
|
|
123
|
-
var identification = _a.identification, password = _a.password, apiUrl = _a.apiUrl, isAuth0Enabled = _a.isAuth0Enabled;
|
|
142
|
+
var identification = _a.identification, password = _a.password, apiUrl = _a.apiUrl, isAuth0Enabled = _a.isAuth0Enabled, isLegacyEnabled = _a.isLegacyEnabled;
|
|
124
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
144
|
var ACCOUNT_SECURITY_TOKEN_RESOURCE, options, tokenName, query, responseOfPost, bodyOfPost, _b, _c;
|
|
126
145
|
return __generator(this, function (_d) {
|
|
@@ -138,6 +157,7 @@ function getOrCreateApiSecurityToken(_a) {
|
|
|
138
157
|
password: password,
|
|
139
158
|
name: tokenName,
|
|
140
159
|
isAuth0AuthenticationEnabled: isAuth0Enabled,
|
|
160
|
+
isLegacyAuthenticationEnabled: isLegacyEnabled,
|
|
141
161
|
};
|
|
142
162
|
return [4 /*yield*/, (0, helper_1.postResource)(options, ACCOUNT_SECURITY_TOKEN_RESOURCE, query)];
|
|
143
163
|
case 1:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA0B;AAC1B,iCAAmC;AACnC,6BAA+B;AAC/B,uBAAyB;AACzB,uEAAsE;AACtE,uDAAsD;AACtD,mFAAmF;AACnF,oCAAqE;A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