@telia-ace/alliance-portal 1.0.5-next.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 +115 -0
- package/LICENSE.txt +9 -0
- package/README.md +3 -0
- package/dist/app.controller.js +227 -0
- package/dist/app.module.js +31 -0
- package/dist/config.js +67 -0
- package/dist/graphql/generated.js +4 -0
- package/dist/graphql/index.js +17 -0
- package/dist/index.js +54 -0
- package/package.json +52 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# @telia-ace/alliance-portal
|
|
2
|
+
|
|
3
|
+
## 1.0.5-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 59f0d3f: Remove unnecessary scripts.
|
|
8
|
+
- Updated dependencies [59f0d3f]
|
|
9
|
+
- @telia-ace/alliance-internal-node-utilities@1.0.2-next.0
|
|
10
|
+
|
|
11
|
+
## 1.0.5-next.0
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 8763155: Update all dependencies to latest.
|
|
16
|
+
|
|
17
|
+
## 1.0.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- 511ba31: Implement exception handling with error codes linking to [SDK error code wiki on GitHub](https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes) (https://github.com/telia-company/ace-alliance-sdk/issues/24).
|
|
22
|
+
- 236e315: Add cookie policy document route.
|
|
23
|
+
- 511ba31: Add trace logs.
|
|
24
|
+
- 511ba31: Use PinoJS to handle logging, add support for `SERVICE_LOG_LEVEL` environment variable (https://github.com/telia-company/ace-alliance-sdk/issues/24).
|
|
25
|
+
- Updated dependencies [fd378fe]
|
|
26
|
+
- @telia-ace/alliance-internal-node-utilities@1.0.1
|
|
27
|
+
|
|
28
|
+
## 1.0.4-next.2
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- Updated dependencies [fd378fe]
|
|
33
|
+
- @telia-ace/alliance-internal-node-utilities@1.0.1-next.0
|
|
34
|
+
|
|
35
|
+
## 1.0.4-next.1
|
|
36
|
+
|
|
37
|
+
### Patch Changes
|
|
38
|
+
|
|
39
|
+
- 511ba31: Implement exception handling with error codes linking to [SDK error code wiki on GitHub](https://github.com/telia-company/ace-alliance-sdk/wiki/error-codes) (https://github.com/telia-company/ace-alliance-sdk/issues/24).
|
|
40
|
+
- 511ba31: Add trace logs.
|
|
41
|
+
- 511ba31: Use PinoJS to handle logging, add support for `SERVICE_LOG_LEVEL` environment variable (https://github.com/telia-company/ace-alliance-sdk/issues/24).
|
|
42
|
+
|
|
43
|
+
## 1.0.4-next.0
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 236e315: Add cookie policy document route.
|
|
48
|
+
|
|
49
|
+
## 1.0.3
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- a327e4e: Replace Passport.js with `express-openid-connect`.
|
|
54
|
+
|
|
55
|
+
## 1.0.3-next.0
|
|
56
|
+
|
|
57
|
+
### Patch Changes
|
|
58
|
+
|
|
59
|
+
- a327e4e: Replace Passport.js with `express-openid-connect`.
|
|
60
|
+
|
|
61
|
+
## 1.0.2
|
|
62
|
+
|
|
63
|
+
### Patch Changes
|
|
64
|
+
|
|
65
|
+
- 1ea5886: Sync the Alliance JWT content with its .NET counterpart.
|
|
66
|
+
|
|
67
|
+
## 1.0.2-next.0
|
|
68
|
+
|
|
69
|
+
### Patch Changes
|
|
70
|
+
|
|
71
|
+
- 2452588: Sync the Alliance JWT content with its .NET counterpart.
|
|
72
|
+
|
|
73
|
+
## 1.0.1
|
|
74
|
+
|
|
75
|
+
### Patch Changes
|
|
76
|
+
|
|
77
|
+
- 0397918: Regenerate GraphQL TypeScript.
|
|
78
|
+
- 1569c8b: Support `WEBPROVISIONS_DISTRIBUTION_URL` configuration value.
|
|
79
|
+
- c89a20d: Add loader to portal HTML.
|
|
80
|
+
- 1569c8b: Use enums for configuration.
|
|
81
|
+
- 69d2ced: Create new users in database after logging in.
|
|
82
|
+
- 51a6f19: Add `@telia-ace/alliance-portal` package.
|
|
83
|
+
- 69d2ced: Update all dependencies to latest.
|
|
84
|
+
|
|
85
|
+
## 1.0.1-next.4
|
|
86
|
+
|
|
87
|
+
### Patch Changes
|
|
88
|
+
|
|
89
|
+
- 0397918: Regenerate GraphQL TypeScript.
|
|
90
|
+
|
|
91
|
+
## 1.0.1-next.3
|
|
92
|
+
|
|
93
|
+
### Patch Changes
|
|
94
|
+
|
|
95
|
+
- 69d2ced: Create new users in database after logging in.
|
|
96
|
+
- 69d2ced: Update all dependencies to latest.
|
|
97
|
+
|
|
98
|
+
## 1.0.1-next.2
|
|
99
|
+
|
|
100
|
+
### Patch Changes
|
|
101
|
+
|
|
102
|
+
- c89a20d: Add loader to portal HTML.
|
|
103
|
+
|
|
104
|
+
## 1.0.1-next.1
|
|
105
|
+
|
|
106
|
+
### Patch Changes
|
|
107
|
+
|
|
108
|
+
- 1569c8b: Support `WEBPROVISIONS_DISTRIBUTION_URL` configuration value.
|
|
109
|
+
- 1569c8b: Use enums for configuration.
|
|
110
|
+
|
|
111
|
+
## 1.0.1-next.0
|
|
112
|
+
|
|
113
|
+
### Patch Changes
|
|
114
|
+
|
|
115
|
+
- 51a6f19: Add `@telia-ace/alliance-portal` package.
|
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
(c) Copyright Telia Company AB 2023
|
|
2
|
+
|
|
3
|
+
This software may be used and/or copied only with the written
|
|
4
|
+
permission from Telia Company AB, or in accordance with
|
|
5
|
+
the terms and conditions stipulated in the agreement/contract
|
|
6
|
+
under which the software has been supplied.
|
|
7
|
+
All rights reserved.
|
|
8
|
+
|
|
9
|
+
Software packages under the scopes @telia-ace, @webprovisions and @webprovisions-registry are also subjected to the above statement.
|
package/README.md
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.AppController = void 0;
|
|
16
|
+
const axios_1 = require("@nestjs/axios");
|
|
17
|
+
const common_1 = require("@nestjs/common");
|
|
18
|
+
const config_1 = require("@nestjs/config");
|
|
19
|
+
const alliance_internal_node_utilities_1 = require("@telia-ace/alliance-internal-node-utilities");
|
|
20
|
+
const config_2 = require("./config");
|
|
21
|
+
let AppController = exports.AppController = class AppController {
|
|
22
|
+
logger;
|
|
23
|
+
configService;
|
|
24
|
+
httpService;
|
|
25
|
+
constructor(logger, configService, httpService) {
|
|
26
|
+
this.logger = logger;
|
|
27
|
+
this.configService = configService;
|
|
28
|
+
this.httpService = httpService;
|
|
29
|
+
}
|
|
30
|
+
signin() { }
|
|
31
|
+
catchall() {
|
|
32
|
+
return '';
|
|
33
|
+
}
|
|
34
|
+
async cookiePolicy() {
|
|
35
|
+
const policyUrl = this.configService.getOrThrow(config_2.ConfigKeys.WebprovisionsDistributionCookiePolicyUrl);
|
|
36
|
+
const { data } = await this.httpService.axiosRef.get(policyUrl);
|
|
37
|
+
return data;
|
|
38
|
+
}
|
|
39
|
+
index(req) {
|
|
40
|
+
const distributionOptions = {};
|
|
41
|
+
const distributionUrl = this.configService.getOrThrow(config_2.ConfigKeys.WebprovisionsDistributionUrl);
|
|
42
|
+
if (!req.query['wp-tag'] && !req.query['wp-version']) {
|
|
43
|
+
distributionOptions.tag = this.configService.getOrThrow(config_2.ConfigKeys.WebprovisionsTag);
|
|
44
|
+
}
|
|
45
|
+
this.logger.trace({
|
|
46
|
+
msg: 'opening portal',
|
|
47
|
+
user: req.oidc.user,
|
|
48
|
+
distributionOptions,
|
|
49
|
+
distributionUrl,
|
|
50
|
+
});
|
|
51
|
+
return htmlTemplate(distributionUrl, distributionOptions);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
__decorate([
|
|
55
|
+
(0, common_1.Get)('/signin-oidc'),
|
|
56
|
+
__metadata("design:type", Function),
|
|
57
|
+
__metadata("design:paramtypes", []),
|
|
58
|
+
__metadata("design:returntype", void 0)
|
|
59
|
+
], AppController.prototype, "signin", null);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, common_1.Get)('/favicon*'),
|
|
62
|
+
__metadata("design:type", Function),
|
|
63
|
+
__metadata("design:paramtypes", []),
|
|
64
|
+
__metadata("design:returntype", void 0)
|
|
65
|
+
], AppController.prototype, "catchall", null);
|
|
66
|
+
__decorate([
|
|
67
|
+
(0, common_1.Get)('/:workspace/cookie-policy'),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", []),
|
|
70
|
+
__metadata("design:returntype", Promise)
|
|
71
|
+
], AppController.prototype, "cookiePolicy", null);
|
|
72
|
+
__decorate([
|
|
73
|
+
(0, common_1.Get)(['/:workspace', '/:workspace/*']),
|
|
74
|
+
__param(0, (0, common_1.Req)()),
|
|
75
|
+
__metadata("design:type", Function),
|
|
76
|
+
__metadata("design:paramtypes", [Object]),
|
|
77
|
+
__metadata("design:returntype", void 0)
|
|
78
|
+
], AppController.prototype, "index", null);
|
|
79
|
+
exports.AppController = AppController = __decorate([
|
|
80
|
+
(0, common_1.Controller)(),
|
|
81
|
+
__metadata("design:paramtypes", [alliance_internal_node_utilities_1.LoggerService,
|
|
82
|
+
config_1.ConfigService,
|
|
83
|
+
axios_1.HttpService])
|
|
84
|
+
], AppController);
|
|
85
|
+
// Taken from https://loading.io/css
|
|
86
|
+
const loader = `
|
|
87
|
+
<style>
|
|
88
|
+
.alliance-portal-loader-wrapper {
|
|
89
|
+
position: fixed;
|
|
90
|
+
inset: 0;
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
align-items: center;
|
|
94
|
+
}
|
|
95
|
+
.alliance-portal-loader {
|
|
96
|
+
display: inline-block;
|
|
97
|
+
position: relative;
|
|
98
|
+
width: 80px;
|
|
99
|
+
height: 80px;
|
|
100
|
+
}
|
|
101
|
+
.alliance-portal-loader div {
|
|
102
|
+
animation: alliance-portal-loader 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
|
|
103
|
+
transform-origin: 40px 40px;
|
|
104
|
+
}
|
|
105
|
+
.alliance-portal-loader div:after {
|
|
106
|
+
content: ' ';
|
|
107
|
+
display: block;
|
|
108
|
+
position: absolute;
|
|
109
|
+
width: 7px;
|
|
110
|
+
height: 7px;
|
|
111
|
+
border-radius: 50%;
|
|
112
|
+
background: #29003e;
|
|
113
|
+
margin: -4px 0 0 -4px;
|
|
114
|
+
}
|
|
115
|
+
.alliance-portal-loader div:nth-child(1) {
|
|
116
|
+
animation-delay: -0.036s;
|
|
117
|
+
}
|
|
118
|
+
.alliance-portal-loader div:nth-child(1):after {
|
|
119
|
+
top: 63px;
|
|
120
|
+
left: 63px;
|
|
121
|
+
}
|
|
122
|
+
.alliance-portal-loader div:nth-child(2) {
|
|
123
|
+
animation-delay: -0.072s;
|
|
124
|
+
}
|
|
125
|
+
.alliance-portal-loader div:nth-child(2):after {
|
|
126
|
+
top: 68px;
|
|
127
|
+
left: 56px;
|
|
128
|
+
}
|
|
129
|
+
.alliance-portal-loader div:nth-child(3) {
|
|
130
|
+
animation-delay: -0.108s;
|
|
131
|
+
}
|
|
132
|
+
.alliance-portal-loader div:nth-child(3):after {
|
|
133
|
+
top: 71px;
|
|
134
|
+
left: 48px;
|
|
135
|
+
}
|
|
136
|
+
.alliance-portal-loader div:nth-child(4) {
|
|
137
|
+
animation-delay: -0.144s;
|
|
138
|
+
}
|
|
139
|
+
.alliance-portal-loader div:nth-child(4):after {
|
|
140
|
+
top: 72px;
|
|
141
|
+
left: 40px;
|
|
142
|
+
}
|
|
143
|
+
.alliance-portal-loader div:nth-child(5) {
|
|
144
|
+
animation-delay: -0.18s;
|
|
145
|
+
}
|
|
146
|
+
.alliance-portal-loader div:nth-child(5):after {
|
|
147
|
+
top: 71px;
|
|
148
|
+
left: 32px;
|
|
149
|
+
}
|
|
150
|
+
.alliance-portal-loader div:nth-child(6) {
|
|
151
|
+
animation-delay: -0.216s;
|
|
152
|
+
}
|
|
153
|
+
.alliance-portal-loader div:nth-child(6):after {
|
|
154
|
+
top: 68px;
|
|
155
|
+
left: 24px;
|
|
156
|
+
}
|
|
157
|
+
.alliance-portal-loader div:nth-child(7) {
|
|
158
|
+
animation-delay: -0.252s;
|
|
159
|
+
}
|
|
160
|
+
.alliance-portal-loader div:nth-child(7):after {
|
|
161
|
+
top: 63px;
|
|
162
|
+
left: 17px;
|
|
163
|
+
}
|
|
164
|
+
.alliance-portal-loader div:nth-child(8) {
|
|
165
|
+
animation-delay: -0.288s;
|
|
166
|
+
}
|
|
167
|
+
.alliance-portal-loader div:nth-child(8):after {
|
|
168
|
+
top: 56px;
|
|
169
|
+
left: 12px;
|
|
170
|
+
}
|
|
171
|
+
@keyframes alliance-portal-loader {
|
|
172
|
+
0% {
|
|
173
|
+
transform: rotate(0deg);
|
|
174
|
+
}
|
|
175
|
+
100% {
|
|
176
|
+
transform: rotate(360deg);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
</style>
|
|
180
|
+
<div class="alliance-portal-loader-wrapper">
|
|
181
|
+
<div class="alliance-portal-loader">
|
|
182
|
+
<div></div>
|
|
183
|
+
<div></div>
|
|
184
|
+
<div></div>
|
|
185
|
+
<div></div>
|
|
186
|
+
<div></div>
|
|
187
|
+
<div></div>
|
|
188
|
+
<div></div>
|
|
189
|
+
<div></div>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|
|
192
|
+
`;
|
|
193
|
+
function htmlTemplate(distributionUrl, distributionOpts) {
|
|
194
|
+
return `
|
|
195
|
+
<!DOCTYPE html>
|
|
196
|
+
<html lang="en">
|
|
197
|
+
|
|
198
|
+
<head>
|
|
199
|
+
<meta charset="UTF-8" />
|
|
200
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
201
|
+
<title>Alliance Portal</title>
|
|
202
|
+
<link rel="icon"
|
|
203
|
+
href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGcElEQVRYha2Xe4xUVx3HP7/fPTOzDLO7sw8RlzWlZEtp2dCy0qIVWltKU/UPDZH6ijXWEK2odPcPa2qbhpi2kSa7blSStsFUjNq0lWCMaVMx8rAm22IJMJRHCqFC6BJ22eEx+5p7z88/7sywC7uwgCe5mXsz5/y+j/M753eOcJ2tK5sDyBrME2gBmkBq43/tnMERgXdAjrbn518yXq4RNA3cB/J54HNiMhfEicm4oAYghmHexN4Dew5k01giUybQlc1h0CbI9zC+Imi9mCAIYhoHsnI4KcNjYoDhxWPxsxFY1Z5vHQVwVwSu3Qdid4E8rSb3i6mqKYwBjpWX1V/QZBiYYWIIiifCw8Mm/vS7L/W237FqJno58M5srgmxP4npjsAHDwTeaeAdagGBdwQWoBYgFqCmqGlMqvTE3+U+ipbeE+ngB42Lde6kDnRmcwisAHlBfdBYCYxStp3y7xjTJ51RA0XxgGCkasQFSfkW8NQlBDqzOR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3pAkkXIanScc6Tf1RfRiJyYHN4Iq/O2PZ/zc71Rpz89P+30bz4QmdltHvvXQpARKJB5R0w0XSvL4cjwV+FnLU+HiZ2tUpxtbf9Tnj20vOJPo2fZ8688u7n3pmdB42Yt/xUuESVQ+yVJexZNtVmbQ2JYIH9zcGC5/pd71Hxjxm5f1cnzboDPx7xs8M9G4CSV1ZnOZICE7GNXbKweTMU7EA6USoemeVLhgTYame1Nu4MBI2PN0ng+3DDovIZFG5w37bEe+dc+UCQC8/ZtjzX07i/88saU4J8yLXiAhaCC+fn7Sz/7iNFq+mqZ6TuD6do+Gu7vPcuQvBRf62LlIQ2/Y1zvyra9OhnPZSf1g58k5I6ftDSnqnNFTaOACqmclfP0tSa3KBjrc5/2Hbwz7Q38ocHLniDM8XjxeIrxG3rA16vXXj529dVKMK2bVL2fkmhrmJ/9cPy91Z2ZGwhMqQx95TudC8gdCZx4obbMVAhqNGvaoCr99bKD1svGntK4647vg84J8X021PBXlK5gJGJWr11GDb3fkW7dPJfaUi3539iARxSUCz4AsERMVpHwDxMTyhq0HftGRbz071bhXfeooXVJvBR4EbgSGgR6Bt9qvArjc/gfZzPoCTDB+AgAAAABJRU5ErkJggg==" />
|
|
204
|
+
</head>
|
|
205
|
+
|
|
206
|
+
<body>
|
|
207
|
+
<script>
|
|
208
|
+
/* WEBPROVISIONS */
|
|
209
|
+
!function(e,n){var o=n||{},c=document,t=window,s=function(n,o){e+=(e.indexOf("?")>-1?"&":"?")+encodeURIComponent(n)+"="
|
|
210
|
+
+encodeURIComponent(o)},i=/[?&]{1}(wp[^=]*)=([^&#]*)/g,r=c.getElementsByTagName("script")[0],p=c.createElement("script");p.type="module";e=e+"/index.js";
|
|
211
|
+
for(t.webprovisions=t.webprovisions||{_c:[],configure:function(){t.webprovisions._c.push(arguments)}};matches=i.exec(t.location.search);)
|
|
212
|
+
s(matches[1],matches[2]);Object.keys(o).forEach((function(e){s("wp-"+e,o[e])})),p.async=!0,p.src=e,r.parentNode.insertBefore(p,r)}
|
|
213
|
+
/**
|
|
214
|
+
* Configure the implementation by specifying a remote endpoint with optional arguments.
|
|
215
|
+
* url - The url to the remote endpoint for the implementation.
|
|
216
|
+
* args - Object containing optional arguments for the implementation.
|
|
217
|
+
*/
|
|
218
|
+
("${distributionUrl}", ${JSON.stringify(distributionOpts)})
|
|
219
|
+
</script>
|
|
220
|
+
|
|
221
|
+
${loader}
|
|
222
|
+
|
|
223
|
+
</body>
|
|
224
|
+
|
|
225
|
+
</html>
|
|
226
|
+
`;
|
|
227
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.AppModule = void 0;
|
|
10
|
+
const axios_1 = require("@nestjs/axios");
|
|
11
|
+
const common_1 = require("@nestjs/common");
|
|
12
|
+
const config_1 = require("@nestjs/config");
|
|
13
|
+
const alliance_internal_node_utilities_1 = require("@telia-ace/alliance-internal-node-utilities");
|
|
14
|
+
const app_controller_1 = require("./app.controller");
|
|
15
|
+
const config_2 = require("./config");
|
|
16
|
+
let AppModule = exports.AppModule = class AppModule {
|
|
17
|
+
};
|
|
18
|
+
exports.AppModule = AppModule = __decorate([
|
|
19
|
+
(0, common_1.Module)({
|
|
20
|
+
controllers: [app_controller_1.AppController],
|
|
21
|
+
imports: [
|
|
22
|
+
config_1.ConfigModule.forRoot({
|
|
23
|
+
isGlobal: true,
|
|
24
|
+
load: [config_2.configuration],
|
|
25
|
+
}),
|
|
26
|
+
alliance_internal_node_utilities_1.LoggerModule.forRoot(),
|
|
27
|
+
axios_1.HttpModule,
|
|
28
|
+
],
|
|
29
|
+
exports: [],
|
|
30
|
+
})
|
|
31
|
+
], AppModule);
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.localConfiguration = exports.configuration = exports.ConfigKeys = void 0;
|
|
4
|
+
const alliance_internal_node_utilities_1 = require("@telia-ace/alliance-internal-node-utilities");
|
|
5
|
+
var ConfigKeys;
|
|
6
|
+
(function (ConfigKeys) {
|
|
7
|
+
ConfigKeys["AuthScopes"] = "AUTH_SCOPES";
|
|
8
|
+
ConfigKeys["AuthClientSecret"] = "AUTH_CLIENT_SECRET";
|
|
9
|
+
ConfigKeys["AuthClientId"] = "AUTH_CLIENT_ID";
|
|
10
|
+
ConfigKeys["AuthResponseType"] = "AUTH_RESPONSE_TYPE";
|
|
11
|
+
ConfigKeys["ServiceBaseUrl"] = "SERVICE_BASE_URL";
|
|
12
|
+
ConfigKeys["WebprovisionsTag"] = "WEBPROVISIONS_TAG";
|
|
13
|
+
ConfigKeys["WebprovisionsDistributionUrl"] = "WEBPROVISIONS_DISTRIBUTION_URL";
|
|
14
|
+
ConfigKeys["WebprovisionsDistributionCookiePolicyUrl"] = "WEBPROVISIONS_DISTRIBUTION_COOKIE_POLICY_URL";
|
|
15
|
+
})(ConfigKeys || (exports.ConfigKeys = ConfigKeys = {}));
|
|
16
|
+
function configuration() {
|
|
17
|
+
return {
|
|
18
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieName]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieName],
|
|
19
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieSecret]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieSecret],
|
|
20
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthAuthority]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.AuthAuthority],
|
|
21
|
+
[ConfigKeys.AuthScopes]: process.env[ConfigKeys.AuthScopes],
|
|
22
|
+
[ConfigKeys.AuthClientSecret]: process.env[ConfigKeys.AuthClientSecret],
|
|
23
|
+
[ConfigKeys.AuthClientId]: process.env[ConfigKeys.AuthClientId],
|
|
24
|
+
[ConfigKeys.AuthResponseType]: process.env[ConfigKeys.AuthResponseType],
|
|
25
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.ServicePort]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.ServicePort],
|
|
26
|
+
[ConfigKeys.ServiceBaseUrl]: process.env[ConfigKeys.ServiceBaseUrl],
|
|
27
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.ServiceLogLevel]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.ServiceLogLevel],
|
|
28
|
+
[ConfigKeys.WebprovisionsTag]: process.env[ConfigKeys.WebprovisionsTag],
|
|
29
|
+
[ConfigKeys.WebprovisionsDistributionUrl]: process.env[ConfigKeys.WebprovisionsDistributionUrl],
|
|
30
|
+
[ConfigKeys.WebprovisionsDistributionCookiePolicyUrl]: process.env[ConfigKeys.WebprovisionsDistributionCookiePolicyUrl],
|
|
31
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.JwtPrivateKey]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.JwtPrivateKey],
|
|
32
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.DbEndpoint]: process.env[alliance_internal_node_utilities_1.SharedConfigKeys.DbEndpoint],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
exports.configuration = configuration;
|
|
36
|
+
// ACE KNOWLEDGE AD
|
|
37
|
+
const auth = {
|
|
38
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthAuthority]: 'https://humanyb2c.b2clogin.com/humanyb2c.onmicrosoft.com/B2C_1_Alliance.Test/v2.0',
|
|
39
|
+
[ConfigKeys.AuthClientSecret]: 'z6r7Q~Snpk7NRPSdi1XrKrf~.GVw~AWb3pxYj',
|
|
40
|
+
[ConfigKeys.AuthClientId]: 'fa9f111b-006e-4633-a7ea-2db825ba898d',
|
|
41
|
+
[ConfigKeys.AuthScopes]: 'openid',
|
|
42
|
+
[ConfigKeys.AuthResponseType]: 'id_token',
|
|
43
|
+
};
|
|
44
|
+
// ACE AUTH PLATFORM
|
|
45
|
+
// const auth = {
|
|
46
|
+
// [SharedConfigKeys.AuthAuthority]: 'https://auth.acedev.teliacompany.net/realms/ace',
|
|
47
|
+
// [ConfigKeys.AuthClientSecret]: '3x1GEvmAdq42CfkgHKi3GJJnzaOKUEYT',
|
|
48
|
+
// [ConfigKeys.AuthClientId]: 'ace-alliance',
|
|
49
|
+
// [ConfigKeys.AuthScopes]: 'openid',
|
|
50
|
+
// [ConfigKeys.AuthResponseType]: 'code',
|
|
51
|
+
// };
|
|
52
|
+
function localConfiguration() {
|
|
53
|
+
return {
|
|
54
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieName]: 'alliance-auth',
|
|
55
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.AuthCookieSecret]: 'zlLZBlk7wt8lypP5lA4D',
|
|
56
|
+
...auth,
|
|
57
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.ServicePort]: 3000,
|
|
58
|
+
[ConfigKeys.ServiceBaseUrl]: 'http://localhost:{{port}}',
|
|
59
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.ServiceLogLevel]: 'trace',
|
|
60
|
+
[ConfigKeys.WebprovisionsTag]: 'dev',
|
|
61
|
+
[ConfigKeys.WebprovisionsDistributionUrl]: 'https://embed.webprovisions.io/p/alliance-portal',
|
|
62
|
+
[ConfigKeys.WebprovisionsDistributionCookiePolicyUrl]: 'https://embed.webprovisions.io/p/alliance-portal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I7vMn75AetB8wYXpOFFeCG/Ck/VSIYP7oAN8kLw8EHdOuNbZYbu34bUCgYBYd14ZOBiZZS4yUlrJ2tc6atOgoNJ4OcTO8LcXXaHYEmenUF9iAf4UGygSoyDJ1CvtW9kLCK+4g7xlFx/dsVkU4qq9PyIA2tNmMHQ0qCedXU8z35huTnRGSDV81gmzyhtQsezgoTWp8Cy6HHKjG6fKasWlx2SKKk8m+Eu3c396QQKBgBMY2asq4M7VU+RiUXCwHwTe+4Wjda7PGvcdTw6Du3vYyVNVxXtr2AG+8uPIjnVQFT6ZApSqToEOAAOjXv6SZDHGU5xiXhUOfIXq0a0OmHv4rIXZv3pPZmGs5k+rA0uGAfH7riiIHBkWxmQ3ivty9lPVgAHobIvvaQmbxNeVVnRxAoGAUzUmcBiUAiODfjulrpYvWG0tCn5B//yk7g1Tm3Chrh9huA1qGEN3jDoqSsTd5k4Yi5foyAZt5ORgoiUVm4IsfS56aoxIco1CtFG3zeMQRy4uKzTsvUTOdsJ4RlQdjNwpngXR44VL0WelgCDqTqJwn5ubzPvuIHuTj3cBpmJCjOo=',
|
|
64
|
+
[alliance_internal_node_utilities_1.SharedConfigKeys.DbEndpoint]: 'http://localhost:3002/graphql',
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
exports.localConfiguration = localConfiguration;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GetOrCreateUserDocument = void 0;
|
|
4
|
+
exports.GetOrCreateUserDocument = { "kind": "Document", "definitions": [{ "kind": "OperationDefinition", "operation": "mutation", "name": { "kind": "Name", "value": "GetOrCreateUser" }, "variableDefinitions": [{ "kind": "VariableDefinition", "variable": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } }, "type": { "kind": "NonNullType", "type": { "kind": "NamedType", "name": { "kind": "Name", "value": "GetOrCreateUserInput" } } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "getOrCreateUser" }, "arguments": [{ "kind": "Argument", "name": { "kind": "Name", "value": "input" }, "value": { "kind": "Variable", "name": { "kind": "Name", "value": "input" } } }], "selectionSet": { "kind": "SelectionSet", "selections": [{ "kind": "Field", "name": { "kind": "Name", "value": "objectId" } }, { "kind": "Field", "name": { "kind": "Name", "value": "displayName" } }, { "kind": "Field", "name": { "kind": "Name", "value": "type" } }] } }] } }] };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./generated"), exports);
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const config_1 = require("@nestjs/config");
|
|
4
|
+
const core_1 = require("@nestjs/core");
|
|
5
|
+
const alliance_internal_node_utilities_1 = require("@telia-ace/alliance-internal-node-utilities");
|
|
6
|
+
const graphql_request_1 = require("graphql-request");
|
|
7
|
+
const jose_1 = require("jose");
|
|
8
|
+
const app_module_1 = require("./app.module");
|
|
9
|
+
const config_2 = require("./config");
|
|
10
|
+
const graphql_1 = require("./graphql");
|
|
11
|
+
async function startPortal() {
|
|
12
|
+
const app = await core_1.NestFactory.create(app_module_1.AppModule, { bufferLogs: true });
|
|
13
|
+
const configService = app.get(config_1.ConfigService);
|
|
14
|
+
const logger = await app.resolve(alliance_internal_node_utilities_1.LoggerService);
|
|
15
|
+
app.useLogger(logger);
|
|
16
|
+
app.flushLogs();
|
|
17
|
+
app.useGlobalInterceptors(new alliance_internal_node_utilities_1.LoggerErrorInterceptor());
|
|
18
|
+
app.useGlobalFilters(new alliance_internal_node_utilities_1.AllianceExceptionFilter());
|
|
19
|
+
app.use((0, alliance_internal_node_utilities_1.authMiddleware)(configService, {
|
|
20
|
+
baseURL: configService
|
|
21
|
+
.getOrThrow(config_2.ConfigKeys.ServiceBaseUrl)
|
|
22
|
+
.replace('{{port}}', configService.getOrThrow(alliance_internal_node_utilities_1.SharedConfigKeys.ServicePort)),
|
|
23
|
+
clientSecret: configService.getOrThrow(config_2.ConfigKeys.AuthClientSecret),
|
|
24
|
+
clientID: configService.getOrThrow(config_2.ConfigKeys.AuthClientId),
|
|
25
|
+
authorizationParams: {
|
|
26
|
+
response_type: configService.getOrThrow(config_2.ConfigKeys.AuthResponseType),
|
|
27
|
+
scope: configService.getOrThrow(config_2.ConfigKeys.AuthScopes),
|
|
28
|
+
},
|
|
29
|
+
async afterCallback(_, __, session) {
|
|
30
|
+
const claims = (0, jose_1.decodeJwt)(session.id_token);
|
|
31
|
+
const user = {
|
|
32
|
+
displayName: claims.name || 'Empty displayName',
|
|
33
|
+
email: claims.email || claims.emails[0] || 'Empty email',
|
|
34
|
+
objectId: claims.sub || claims.oid,
|
|
35
|
+
};
|
|
36
|
+
logger.trace({
|
|
37
|
+
msg: 'decoded JWT and mapped claims to user, getting or creating user in database',
|
|
38
|
+
claims,
|
|
39
|
+
user,
|
|
40
|
+
});
|
|
41
|
+
try {
|
|
42
|
+
// Create user in database if it doesn't exist
|
|
43
|
+
await (0, graphql_request_1.request)(configService.getOrThrow(alliance_internal_node_utilities_1.SharedConfigKeys.DbEndpoint), graphql_1.GetOrCreateUserDocument, { input: user }, {
|
|
44
|
+
authorization: (0, alliance_internal_node_utilities_1.createSystemUserToken)(configService),
|
|
45
|
+
});
|
|
46
|
+
logger.trace({ msg: 'added user to database, if it did not already exist' });
|
|
47
|
+
}
|
|
48
|
+
catch { }
|
|
49
|
+
return session;
|
|
50
|
+
},
|
|
51
|
+
}));
|
|
52
|
+
await app.listen(configService.getOrThrow(alliance_internal_node_utilities_1.SharedConfigKeys.ServicePort));
|
|
53
|
+
}
|
|
54
|
+
startPortal();
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telia-ace/alliance-portal",
|
|
3
|
+
"version": "1.0.5-next.1",
|
|
4
|
+
"description": "ACE Alliance portal",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"author": "Telia Company AB",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"LICENSE.txt",
|
|
11
|
+
"README.md",
|
|
12
|
+
"CHANGELOG.md",
|
|
13
|
+
"dist/"
|
|
14
|
+
],
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@auth/core": "^0.10.0",
|
|
17
|
+
"@nestjs/axios": "^3.0.0",
|
|
18
|
+
"@nestjs/common": "^10.1.0",
|
|
19
|
+
"@nestjs/config": "^3.0.0",
|
|
20
|
+
"@nestjs/core": "^10.1.0",
|
|
21
|
+
"@nestjs/platform-express": "^10.1.0",
|
|
22
|
+
"@telia-ace/alliance-internal-node-utilities": "1.0.2-next.0",
|
|
23
|
+
"express-openid-connect": "^2.16.0",
|
|
24
|
+
"graphql": "^16.7.1",
|
|
25
|
+
"graphql-request": "^6.1.0",
|
|
26
|
+
"jose": "^4.14.4",
|
|
27
|
+
"jsonwebtoken": "^9.0.1",
|
|
28
|
+
"reflect-metadata": "^0.1.13",
|
|
29
|
+
"rxjs": "^7.8.1"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@graphql-codegen/cli": "^4.0.1",
|
|
33
|
+
"@graphql-codegen/typed-document-node": "^5.0.1",
|
|
34
|
+
"@graphql-codegen/typescript-operations": "^4.0.1",
|
|
35
|
+
"@graphql-typed-document-node/core": "^3.2.0",
|
|
36
|
+
"@nestjs/cli": "^10.1.10",
|
|
37
|
+
"@types/express": "^4.17.17",
|
|
38
|
+
"@types/jsonwebtoken": "^9.0.2",
|
|
39
|
+
"@types/node": "^20.4.2",
|
|
40
|
+
"express": "^4.18.2"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"scripts": {
|
|
46
|
+
"dev": "nest start --watch",
|
|
47
|
+
"build:dev": "nest build",
|
|
48
|
+
"build:prod": "nest build",
|
|
49
|
+
"start": "node dist/index",
|
|
50
|
+
"generate": "graphql-codegen"
|
|
51
|
+
}
|
|
52
|
+
}
|