@signageos/cli 1.3.1 → 1.4.1
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 +10 -0
- package/README.md +3 -0
- package/dist/Auth/loginCommand.d.ts +10 -2
- package/dist/Auth/loginCommand.js +36 -18
- package/dist/Auth/loginCommand.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -4,7 +4,17 @@ 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.1] - 2023-10-02
|
|
8
|
+
### Fixed
|
|
9
|
+
- Auth0 compatibility (auto select)
|
|
10
|
+
|
|
11
|
+
## [1.4.0] - 2023-09-25
|
|
12
|
+
### Added
|
|
13
|
+
- Update readme
|
|
14
|
+
- Auth0 compatibility
|
|
15
|
+
|
|
7
16
|
## [1.3.1] - 2023-08-29
|
|
17
|
+
|
|
8
18
|
## [1.3.0] - 2023-05-19
|
|
9
19
|
### Fixed
|
|
10
20
|
- 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 | undefined;
|
|
18
|
+
isLegacyEnabled?: boolean | undefined;
|
|
19
|
+
};
|
|
12
20
|
export declare const login: {
|
|
13
21
|
name: "login";
|
|
14
22
|
description: string;
|
|
@@ -1,4 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
2
13
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
14
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
15
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -36,7 +47,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
47
|
}
|
|
37
48
|
};
|
|
38
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.login = exports.
|
|
50
|
+
exports.login = exports.getIsAuth0OrLegacyEnabled = void 0;
|
|
40
51
|
var chalk_1 = require("chalk");
|
|
41
52
|
var prompts = require("prompts");
|
|
42
53
|
var Debug = require("debug");
|
|
@@ -51,19 +62,31 @@ var commandDefinition_1 = require("../Command/commandDefinition");
|
|
|
51
62
|
var debug = Debug('@signageos/cli:Auth:login');
|
|
52
63
|
var OPTION_LIST = [{ name: 'username', type: String, description: "Username or e-mail used for ".concat(parameters_1.parameters.boxHost) }];
|
|
53
64
|
/**
|
|
54
|
-
*
|
|
65
|
+
* To explicitly enable auth0 authentication add flag --auth0-enabled to command line options
|
|
55
66
|
* { _unknown: [ '--auth0-enabled' ], command: [ 'login' ] }
|
|
67
|
+
*
|
|
68
|
+
* To explicitly enable legacy authentication add flag --legacy-enabled to command line options
|
|
69
|
+
* { _unknown: [ '--legacy-enabled' ], command: [ 'login' ] }
|
|
70
|
+
*
|
|
71
|
+
* Only one from auth0 and legacy authentication can be active at the moment
|
|
56
72
|
*/
|
|
57
|
-
var
|
|
58
|
-
var _a;
|
|
59
|
-
var
|
|
73
|
+
var getIsAuth0OrLegacyEnabled = function (options) {
|
|
74
|
+
var _a, _b;
|
|
75
|
+
var queryParams = {};
|
|
60
76
|
// tslint:disable-next-line no-string-literal
|
|
61
77
|
if ((_a = options['_unknown']) === null || _a === void 0 ? void 0 : _a.includes('--auth0-enabled')) {
|
|
62
|
-
isAuth0Enabled = true;
|
|
78
|
+
queryParams.isAuth0Enabled = true;
|
|
79
|
+
}
|
|
80
|
+
// tslint:disable-next-line no-string-literal
|
|
81
|
+
if ((_b = options['_unknown']) === null || _b === void 0 ? void 0 : _b.includes('--legacy-enabled')) {
|
|
82
|
+
queryParams.isLegacyEnabled = true;
|
|
63
83
|
}
|
|
64
|
-
|
|
84
|
+
if (queryParams.isAuth0Enabled !== undefined && queryParams.isLegacyEnabled !== undefined) {
|
|
85
|
+
throw new Error('Only one override from auth0 and legacy authentication options can be active at the moment.');
|
|
86
|
+
}
|
|
87
|
+
return queryParams;
|
|
65
88
|
};
|
|
66
|
-
exports.
|
|
89
|
+
exports.getIsAuth0OrLegacyEnabled = getIsAuth0OrLegacyEnabled;
|
|
67
90
|
exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
68
91
|
name: 'login',
|
|
69
92
|
description: 'Login account using username & password',
|
|
@@ -71,7 +94,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
71
94
|
commands: [],
|
|
72
95
|
run: function (options) {
|
|
73
96
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var identification, response, password, config, apiUrl,
|
|
97
|
+
var identification, response, password, config, apiUrl, authQueryParams, _a, tokenId, apiSecurityToken, name;
|
|
75
98
|
return __generator(this, function (_b) {
|
|
76
99
|
switch (_b.label) {
|
|
77
100
|
case 0:
|
|
@@ -101,8 +124,8 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
101
124
|
case 4:
|
|
102
125
|
config = _b.sent();
|
|
103
126
|
apiUrl = (0, helper_1.getApiUrl)(config);
|
|
104
|
-
|
|
105
|
-
return [4 /*yield*/, getOrCreateApiSecurityToken({ identification: identification, password: password, apiUrl: apiUrl,
|
|
127
|
+
authQueryParams = (0, exports.getIsAuth0OrLegacyEnabled)(options);
|
|
128
|
+
return [4 /*yield*/, getOrCreateApiSecurityToken(__assign({ identification: identification, password: password, apiUrl: apiUrl }, authQueryParams))];
|
|
106
129
|
case 5:
|
|
107
130
|
_a = _b.sent(), tokenId = _a.id, apiSecurityToken = _a.securityToken, name = _a.name;
|
|
108
131
|
return [4 /*yield*/, (0, runControlHelper_1.saveConfig)({
|
|
@@ -120,7 +143,7 @@ exports.login = (0, commandDefinition_1.createCommandDefinition)({
|
|
|
120
143
|
},
|
|
121
144
|
});
|
|
122
145
|
function getOrCreateApiSecurityToken(_a) {
|
|
123
|
-
var identification = _a.identification, password = _a.password, apiUrl = _a.apiUrl, isAuth0Enabled = _a.isAuth0Enabled;
|
|
146
|
+
var identification = _a.identification, password = _a.password, apiUrl = _a.apiUrl, isAuth0Enabled = _a.isAuth0Enabled, isLegacyEnabled = _a.isLegacyEnabled;
|
|
124
147
|
return __awaiter(this, void 0, void 0, function () {
|
|
125
148
|
var ACCOUNT_SECURITY_TOKEN_RESOURCE, options, tokenName, query, responseOfPost, bodyOfPost, _b, _c;
|
|
126
149
|
return __generator(this, function (_d) {
|
|
@@ -133,12 +156,7 @@ function getOrCreateApiSecurityToken(_a) {
|
|
|
133
156
|
version: apiVersions_1.ApiVersions.V1,
|
|
134
157
|
};
|
|
135
158
|
tokenName = generateTokenName();
|
|
136
|
-
query = {
|
|
137
|
-
identification: identification,
|
|
138
|
-
password: password,
|
|
139
|
-
name: tokenName,
|
|
140
|
-
isAuth0AuthenticationEnabled: isAuth0Enabled,
|
|
141
|
-
};
|
|
159
|
+
query = __assign(__assign({ identification: identification, password: password, name: tokenName }, isAuth0Enabled !== undefined ? { isAuth0AuthenticationEnabled: isAuth0Enabled } : {}), isLegacyEnabled !== undefined ? { isLegacyAuthenticationEnabled: isLegacyEnabled } : {});
|
|
142
160
|
return [4 /*yield*/, (0, helper_1.postResource)(options, ACCOUNT_SECURITY_TOKEN_RESOURCE, query)];
|
|
143
161
|
case 1:
|
|
144
162
|
responseOfPost = _d.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loginCommand.js","sourceRoot":"","sources":["../../src/Auth/loginCommand.ts"],"names":[],"mappings":"
|
|
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;AACrE,mEAAwE;AACxE,4CAA2C;AAC3C,kEAA2F;AAE3F,IAAM,KAAK,GAAG,KAAK,CAAC,2BAA2B,CAAC,CAAC;AAEjD,IAAM,WAAW,GAAG,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,M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AAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7C,IAAM,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC;IAE/B,OAAO,UAAG,QAAQ,CAAC,QAAQ,cAAI,aAAa,CAAE,CAAC;AAChD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signageos/cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"files": [
|
|
6
6
|
".env",
|
|
@@ -35,10 +35,6 @@
|
|
|
35
35
|
"bin": {
|
|
36
36
|
"sos": "./dist/index.js"
|
|
37
37
|
},
|
|
38
|
-
"publishConfig": {
|
|
39
|
-
"registry": "https://registry.npmjs.org/",
|
|
40
|
-
"access": "public"
|
|
41
|
-
},
|
|
42
38
|
"devDependencies": {
|
|
43
39
|
"@istanbuljs/nyc-config-typescript": "1.0.2",
|
|
44
40
|
"@signageos/codestyle": "0.0.23",
|
|
@@ -92,5 +88,9 @@
|
|
|
92
88
|
"prompts": "2.1.0",
|
|
93
89
|
"semver": "7.1.3",
|
|
94
90
|
"serve-static": "1.14.1"
|
|
91
|
+
},
|
|
92
|
+
"publishConfig": {
|
|
93
|
+
"registry": "https://registry.npmjs.org/",
|
|
94
|
+
"access": "public"
|
|
95
95
|
}
|
|
96
96
|
}
|