@studyportals/cors 2.6.1 → 2.6.2
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/{bin/index.d.ts → index.d.ts} +2 -2
- package/{bin/index.js → index.js} +18 -18
- package/package.json +38 -38
- package/{bin/src → src}/domain/allowed-domain-reg-ex-list.d.ts +10 -10
- package/{bin/src → src}/domain/allowed-domain-reg-ex-list.js +28 -27
- package/{bin/src → src}/domain/allowed-explicit-domains-rules.d.ts +42 -42
- package/{bin/src → src}/domain/allowed-explicit-domains-rules.js +46 -42
- package/{bin/src → src}/domain/cors.d.ts +16 -16
- package/{bin/src → src}/domain/cors.js +37 -37
- package/{bin/src → src}/domain/enums/environment.d.ts +4 -4
- package/{bin/src → src}/domain/enums/environment.js +8 -8
- package/{bin/src → src}/domain/enums/index.d.ts +2 -2
- package/{bin/src → src}/domain/enums/index.js +18 -18
- package/{bin/src → src}/domain/enums/scope.d.ts +4 -4
- package/{bin/src → src}/domain/enums/scope.js +8 -8
- package/{bin/src → src}/domain/index.d.ts +3 -3
- package/{bin/src → src}/domain/index.js +19 -19
- package/{bin/src → src}/implementations/express-middleware.d.ts +5 -5
- package/{bin/src → src}/implementations/express-middleware.js +27 -27
- package/{bin/src → src}/implementations/index.d.ts +3 -3
- package/{bin/src → src}/implementations/index.js +19 -19
- package/{bin/src → src}/implementations/options.d.ts +8 -8
- package/{bin/src → src}/implementations/options.js +49 -49
- package/{bin/src → src}/implementations/s3-rules.d.ts +5 -5
- package/{bin/src → src}/implementations/s3-rules.js +12 -12
- package/.codeclimate.yml +0 -25
- package/.github/CODEOWNERS +0 -1
- package/.nycrc +0 -22
- package/.travis.yml +0 -18
- package/README.md +0 -110
- package/index.ts +0 -2
- package/src/domain/allowed-domain-reg-ex-list.ts +0 -26
- package/src/domain/allowed-explicit-domains-rules.ts +0 -56
- package/src/domain/cors.ts +0 -32
- package/src/domain/enums/environment.ts +0 -4
- package/src/domain/enums/index.ts +0 -2
- package/src/domain/enums/scope.ts +0 -4
- package/src/domain/index.ts +0 -3
- package/src/implementations/express-middleware.ts +0 -21
- package/src/implementations/index.ts +0 -3
- package/src/implementations/options.ts +0 -50
- package/src/implementations/s3-rules.ts +0 -12
- package/test/domain/cors.s3.test.ts +0 -92
- package/test/domain/cors.valid.domain.test.ts +0 -155
- package/test/mocha.opts +0 -3
- package/tsconfig.json +0 -38
- package/tslint.json +0 -132
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './src/domain';
|
|
2
|
-
export * from './src/implementations';
|
|
1
|
+
export * from './src/domain';
|
|
2
|
+
export * from './src/implementations';
|
|
@@ -1,18 +1,18 @@
|
|
|
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("./src/domain"), exports);
|
|
18
|
-
__exportStar(require("./src/implementations"), exports);
|
|
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("./src/domain"), exports);
|
|
18
|
+
__exportStar(require("./src/implementations"), exports);
|
package/package.json
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@studyportals/cors",
|
|
3
|
-
"version": "2.6.
|
|
4
|
-
"description": "",
|
|
5
|
-
"main": "bin/index.js",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"test": "mocha test/**/*.test.ts",
|
|
8
|
-
"test:watch": "mocha -w --reporter min test/**/*.test.ts",
|
|
9
|
-
"deploy-patch": "npm version patch && npm run deploy",
|
|
10
|
-
"deploy-minor": "npm version minor && npm run deploy",
|
|
11
|
-
"deploy-major": "npm version major && npm run deploy",
|
|
12
|
-
"prepare-deployment": "cp package.json bin/package.json",
|
|
13
|
-
"deploy": "npm run build && npm run prepare-deployment && npm publish ./bin",
|
|
14
|
-
"build": "rm -rf bin && tsc && rm -rf bin/test",
|
|
15
|
-
"lint": "tslint 'src/**/*.ts'",
|
|
16
|
-
"lint-fix": "tslint --fix 'src/**/*.ts'",
|
|
17
|
-
"test:coverage": "nyc mocha test/**/*.test.ts"
|
|
18
|
-
},
|
|
19
|
-
"private": false,
|
|
20
|
-
"author": "SP - Samurai Pizza Cats",
|
|
21
|
-
"license": "BSD3",
|
|
22
|
-
"dependencies": {
|
|
23
|
-
"@types/express": "^4.17.3"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@types/chai": "^4.1.7",
|
|
27
|
-
"@types/node": "^10.12.15",
|
|
28
|
-
"chai": "^4.2.0",
|
|
29
|
-
"mocha": "^5.2.0",
|
|
30
|
-
"mocha-typescript": "1.1.12",
|
|
31
|
-
"nyc": "^13.3.0",
|
|
32
|
-
"ts-loader": "^2.3.7",
|
|
33
|
-
"ts-node": "^7.0.1",
|
|
34
|
-
"tslint": "^5.11.0",
|
|
35
|
-
"typemoq": "^2.1.0",
|
|
36
|
-
"typescript": "^4.8.4"
|
|
37
|
-
}
|
|
38
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@studyportals/cors",
|
|
3
|
+
"version": "2.6.2",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "bin/index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "mocha test/**/*.test.ts",
|
|
8
|
+
"test:watch": "mocha -w --reporter min test/**/*.test.ts",
|
|
9
|
+
"deploy-patch": "npm version patch && npm run deploy",
|
|
10
|
+
"deploy-minor": "npm version minor && npm run deploy",
|
|
11
|
+
"deploy-major": "npm version major && npm run deploy",
|
|
12
|
+
"prepare-deployment": "cp package.json bin/package.json",
|
|
13
|
+
"deploy": "npm run build && npm run prepare-deployment && npm publish ./bin",
|
|
14
|
+
"build": "rm -rf bin && tsc && rm -rf bin/test",
|
|
15
|
+
"lint": "tslint 'src/**/*.ts'",
|
|
16
|
+
"lint-fix": "tslint --fix 'src/**/*.ts'",
|
|
17
|
+
"test:coverage": "nyc mocha test/**/*.test.ts"
|
|
18
|
+
},
|
|
19
|
+
"private": false,
|
|
20
|
+
"author": "SP - Samurai Pizza Cats",
|
|
21
|
+
"license": "BSD3",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@types/express": "^4.17.3"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@types/chai": "^4.1.7",
|
|
27
|
+
"@types/node": "^10.12.15",
|
|
28
|
+
"chai": "^4.2.0",
|
|
29
|
+
"mocha": "^5.2.0",
|
|
30
|
+
"mocha-typescript": "1.1.12",
|
|
31
|
+
"nyc": "^13.3.0",
|
|
32
|
+
"ts-loader": "^2.3.7",
|
|
33
|
+
"ts-node": "^7.0.1",
|
|
34
|
+
"tslint": "^5.11.0",
|
|
35
|
+
"typemoq": "^2.1.0",
|
|
36
|
+
"typescript": "^4.8.4"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const AllowedDomainRegExList: {
|
|
2
|
-
0: {
|
|
3
|
-
0: RegExp[];
|
|
4
|
-
1: RegExp[];
|
|
5
|
-
};
|
|
6
|
-
1: {
|
|
7
|
-
0: RegExp[];
|
|
8
|
-
1: RegExp[];
|
|
9
|
-
};
|
|
10
|
-
};
|
|
1
|
+
export declare const AllowedDomainRegExList: {
|
|
2
|
+
0: {
|
|
3
|
+
0: RegExp[];
|
|
4
|
+
1: RegExp[];
|
|
5
|
+
};
|
|
6
|
+
1: {
|
|
7
|
+
0: RegExp[];
|
|
8
|
+
1: RegExp[];
|
|
9
|
+
};
|
|
10
|
+
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AllowedDomainRegExList = void 0;
|
|
4
|
-
const environment_1 = require("./enums/environment");
|
|
5
|
-
const scope_1 = require("./enums/scope");
|
|
6
|
-
exports.AllowedDomainRegExList = {
|
|
7
|
-
[scope_1.Scope.Student]: {
|
|
8
|
-
[environment_1.Environment.Production]: [
|
|
9
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.mastersportal\.(com|fyi)(?::3030)?$/,
|
|
10
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.bachelorsportal\.(com|fyi)(?::3030)?$/,
|
|
11
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.phdportal\.(com|fyi)(?::3030)?$/,
|
|
12
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.preparationcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
13
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.distancelearningportal\.(com|fyi)(?::3030)?$/,
|
|
14
|
-
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.shortcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
15
|
-
/^https?:\/\/
|
|
16
|
-
/^https?:\/\/
|
|
17
|
-
/^https?:\/\/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
[environment_1.Environment.
|
|
26
|
-
|
|
27
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllowedDomainRegExList = void 0;
|
|
4
|
+
const environment_1 = require("./enums/environment");
|
|
5
|
+
const scope_1 = require("./enums/scope");
|
|
6
|
+
exports.AllowedDomainRegExList = {
|
|
7
|
+
[scope_1.Scope.Student]: {
|
|
8
|
+
[environment_1.Environment.Production]: [
|
|
9
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.mastersportal\.(com|fyi)(?::3030)?$/,
|
|
10
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.bachelorsportal\.(com|fyi)(?::3030)?$/,
|
|
11
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.phdportal\.(com|fyi)(?::3030)?$/,
|
|
12
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.preparationcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
13
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.distancelearningportal\.(com|fyi)(?::3030)?$/,
|
|
14
|
+
/^https?:\/\/(www(?:\.dev)?|cypress\.rc|rc|beta|[0-9]{4,16}(?:-bob)?\.rc)\.shortcoursesportal\.(com|fyi)(?::3030)?$/,
|
|
15
|
+
/^https?:\/\/(www.)?admissiontestportal.com?$/,
|
|
16
|
+
/^https?:\/\/studentemailing\.prtl\.co$/,
|
|
17
|
+
/^https?:\/\/scholarship\.mastersportal\.com$/,
|
|
18
|
+
/^https?:\/\/search-page\.prtl\.co$/,
|
|
19
|
+
],
|
|
20
|
+
[environment_1.Environment.Testing]: [
|
|
21
|
+
/(.*?)/,
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
[scope_1.Scope.UniAdmin]: {
|
|
25
|
+
[environment_1.Environment.Production]: [/(.*?)/],
|
|
26
|
+
[environment_1.Environment.Testing]: [/(.*?)/],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
export declare type AllowedExplicitDomainsRulesType = typeof AllowedExplicitDomainsRules;
|
|
2
|
-
export declare type CorsRule = {
|
|
3
|
-
allowedOrigins: string[];
|
|
4
|
-
allowedMethods: string[];
|
|
5
|
-
allowedHeaders: string[];
|
|
6
|
-
exposedHeaders: string[];
|
|
7
|
-
maxAge: number;
|
|
8
|
-
};
|
|
9
|
-
export declare const AllowedExplicitDomainsRules: {
|
|
10
|
-
0: {
|
|
11
|
-
0: {
|
|
12
|
-
allowedOrigins: string[];
|
|
13
|
-
allowedHeaders: string[];
|
|
14
|
-
allowedMethods: string[];
|
|
15
|
-
exposedHeaders: never[];
|
|
16
|
-
maxAge: number;
|
|
17
|
-
};
|
|
18
|
-
1: {
|
|
19
|
-
allowedOrigins: string[];
|
|
20
|
-
allowedMethods: string[];
|
|
21
|
-
allowedHeaders: string[];
|
|
22
|
-
exposedHeaders: never[];
|
|
23
|
-
maxAge: number;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
1: {
|
|
27
|
-
0: {
|
|
28
|
-
allowedOrigins: string[];
|
|
29
|
-
allowedHeaders: string[];
|
|
30
|
-
allowedMethods: string[];
|
|
31
|
-
exposedHeaders: never[];
|
|
32
|
-
maxAge: number;
|
|
33
|
-
};
|
|
34
|
-
1: {
|
|
35
|
-
allowedOrigins: string[];
|
|
36
|
-
allowedMethods: string[];
|
|
37
|
-
allowedHeaders: string[];
|
|
38
|
-
exposedHeaders: never[];
|
|
39
|
-
maxAge: number;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
};
|
|
1
|
+
export declare type AllowedExplicitDomainsRulesType = typeof AllowedExplicitDomainsRules;
|
|
2
|
+
export declare type CorsRule = {
|
|
3
|
+
allowedOrigins: string[];
|
|
4
|
+
allowedMethods: string[];
|
|
5
|
+
allowedHeaders: string[];
|
|
6
|
+
exposedHeaders: string[];
|
|
7
|
+
maxAge: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const AllowedExplicitDomainsRules: {
|
|
10
|
+
0: {
|
|
11
|
+
0: {
|
|
12
|
+
allowedOrigins: string[];
|
|
13
|
+
allowedHeaders: string[];
|
|
14
|
+
allowedMethods: string[];
|
|
15
|
+
exposedHeaders: never[];
|
|
16
|
+
maxAge: number;
|
|
17
|
+
};
|
|
18
|
+
1: {
|
|
19
|
+
allowedOrigins: string[];
|
|
20
|
+
allowedMethods: string[];
|
|
21
|
+
allowedHeaders: string[];
|
|
22
|
+
exposedHeaders: never[];
|
|
23
|
+
maxAge: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
1: {
|
|
27
|
+
0: {
|
|
28
|
+
allowedOrigins: string[];
|
|
29
|
+
allowedHeaders: string[];
|
|
30
|
+
allowedMethods: string[];
|
|
31
|
+
exposedHeaders: never[];
|
|
32
|
+
maxAge: number;
|
|
33
|
+
};
|
|
34
|
+
1: {
|
|
35
|
+
allowedOrigins: string[];
|
|
36
|
+
allowedMethods: string[];
|
|
37
|
+
allowedHeaders: string[];
|
|
38
|
+
exposedHeaders: never[];
|
|
39
|
+
maxAge: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
@@ -1,42 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AllowedExplicitDomainsRules = void 0;
|
|
4
|
-
const environment_1 = require("./enums/environment");
|
|
5
|
-
const scope_1 = require("./enums/scope");
|
|
6
|
-
exports.AllowedExplicitDomainsRules = {
|
|
7
|
-
[scope_1.Scope.Student]: {
|
|
8
|
-
[environment_1.Environment.Production]: {
|
|
9
|
-
allowedOrigins: ["*.mastersportal.com", "*.bachelorsportal.com", "*.shortcoursesportal.com",
|
|
10
|
-
"*.distancelearningportal.com", "*.preparationcoursesportal.com", "*.phdportal.com",
|
|
11
|
-
"*.prtl.co", "*.rc.mastersportal.fyi", "*.rc.bachelorsportal.fyi", "*.rc.shortcoursesportal.fyi",
|
|
12
|
-
"*.rc.distancelearningportal.fyi", "*.rc.preparationcoursesportal.fyi", "*.rc.phdportal.fyi"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AllowedExplicitDomainsRules = void 0;
|
|
4
|
+
const environment_1 = require("./enums/environment");
|
|
5
|
+
const scope_1 = require("./enums/scope");
|
|
6
|
+
exports.AllowedExplicitDomainsRules = {
|
|
7
|
+
[scope_1.Scope.Student]: {
|
|
8
|
+
[environment_1.Environment.Production]: {
|
|
9
|
+
allowedOrigins: ["*.mastersportal.com", "*.bachelorsportal.com", "*.shortcoursesportal.com",
|
|
10
|
+
"*.distancelearningportal.com", "*.preparationcoursesportal.com", "*.phdportal.com",
|
|
11
|
+
"*.prtl.co", "*.rc.mastersportal.fyi", "*.rc.bachelorsportal.fyi", "*.rc.shortcoursesportal.fyi",
|
|
12
|
+
"*.rc.distancelearningportal.fyi", "*.rc.preparationcoursesportal.fyi", "*.rc.phdportal.fyi",
|
|
13
|
+
"*.admissiontestportal.com", "https://admissiontestportal.com"],
|
|
14
|
+
allowedHeaders: ["Authorization"],
|
|
15
|
+
allowedMethods: ["GET"],
|
|
16
|
+
exposedHeaders: [],
|
|
17
|
+
maxAge: 3000
|
|
18
|
+
},
|
|
19
|
+
[environment_1.Environment.Testing]: {
|
|
20
|
+
allowedOrigins: ["*"],
|
|
21
|
+
allowedMethods: ["GET"],
|
|
22
|
+
allowedHeaders: ["Authorization"],
|
|
23
|
+
exposedHeaders: [],
|
|
24
|
+
maxAge: 3000
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
[scope_1.Scope.UniAdmin]: {
|
|
28
|
+
[environment_1.Environment.Production]: {
|
|
29
|
+
allowedOrigins: ["*.studyportals.eu"],
|
|
30
|
+
allowedHeaders: ["Authorization"],
|
|
31
|
+
allowedMethods: ["GET", "POST"],
|
|
32
|
+
exposedHeaders: [],
|
|
33
|
+
maxAge: 3000
|
|
34
|
+
},
|
|
35
|
+
[environment_1.Environment.Testing]: {
|
|
36
|
+
allowedOrigins: ["*-uniadmin.prtl.fyi",
|
|
37
|
+
"*.administration.tst.studyportals.eu", "administration.tst.studyportals.eu",
|
|
38
|
+
"https://administration.dev.studyportals.eu:*",
|
|
39
|
+
"*-uniadmin.studyportals.eu"],
|
|
40
|
+
allowedMethods: ["GET"],
|
|
41
|
+
allowedHeaders: ["*"],
|
|
42
|
+
exposedHeaders: [],
|
|
43
|
+
maxAge: 3000
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { CorsRule } from './allowed-explicit-domains-rules';
|
|
2
|
-
import { Environment } from './enums/environment';
|
|
3
|
-
import { Scope } from './enums/scope';
|
|
4
|
-
export declare class CORS {
|
|
5
|
-
private regExes;
|
|
6
|
-
private s3Rules;
|
|
7
|
-
constructor(scope: Scope, environment?: Environment);
|
|
8
|
-
/**
|
|
9
|
-
* isValidDomain
|
|
10
|
-
*/
|
|
11
|
-
isValidDomain(domain: string): Promise<boolean>;
|
|
12
|
-
/**
|
|
13
|
-
* getIamRules
|
|
14
|
-
*/
|
|
15
|
-
getS3Rules(): CorsRule[];
|
|
16
|
-
}
|
|
1
|
+
import { CorsRule } from './allowed-explicit-domains-rules';
|
|
2
|
+
import { Environment } from './enums/environment';
|
|
3
|
+
import { Scope } from './enums/scope';
|
|
4
|
+
export declare class CORS {
|
|
5
|
+
private regExes;
|
|
6
|
+
private s3Rules;
|
|
7
|
+
constructor(scope: Scope, environment?: Environment);
|
|
8
|
+
/**
|
|
9
|
+
* isValidDomain
|
|
10
|
+
*/
|
|
11
|
+
isValidDomain(domain: string): Promise<boolean>;
|
|
12
|
+
/**
|
|
13
|
+
* getIamRules
|
|
14
|
+
*/
|
|
15
|
+
getS3Rules(): CorsRule[];
|
|
16
|
+
}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.CORS = void 0;
|
|
13
|
-
const allowed_domain_reg_ex_list_1 = require("./allowed-domain-reg-ex-list");
|
|
14
|
-
const allowed_explicit_domains_rules_1 = require("./allowed-explicit-domains-rules");
|
|
15
|
-
const environment_1 = require("./enums/environment");
|
|
16
|
-
class CORS {
|
|
17
|
-
constructor(scope, environment = environment_1.Environment.Production) {
|
|
18
|
-
this.regExes = allowed_domain_reg_ex_list_1.AllowedDomainRegExList[scope][environment];
|
|
19
|
-
this.s3Rules = [allowed_explicit_domains_rules_1.AllowedExplicitDomainsRules[scope][environment]];
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* isValidDomain
|
|
23
|
-
*/
|
|
24
|
-
isValidDomain(domain) {
|
|
25
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
-
const hasMatch = this.regExes.filter((regex) => domain.match(regex) !== null);
|
|
27
|
-
return (hasMatch.length !== 0);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* getIamRules
|
|
32
|
-
*/
|
|
33
|
-
getS3Rules() {
|
|
34
|
-
return this.s3Rules;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.CORS = CORS;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CORS = void 0;
|
|
13
|
+
const allowed_domain_reg_ex_list_1 = require("./allowed-domain-reg-ex-list");
|
|
14
|
+
const allowed_explicit_domains_rules_1 = require("./allowed-explicit-domains-rules");
|
|
15
|
+
const environment_1 = require("./enums/environment");
|
|
16
|
+
class CORS {
|
|
17
|
+
constructor(scope, environment = environment_1.Environment.Production) {
|
|
18
|
+
this.regExes = allowed_domain_reg_ex_list_1.AllowedDomainRegExList[scope][environment];
|
|
19
|
+
this.s3Rules = [allowed_explicit_domains_rules_1.AllowedExplicitDomainsRules[scope][environment]];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* isValidDomain
|
|
23
|
+
*/
|
|
24
|
+
isValidDomain(domain) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const hasMatch = this.regExes.filter((regex) => domain.match(regex) !== null);
|
|
27
|
+
return (hasMatch.length !== 0);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* getIamRules
|
|
32
|
+
*/
|
|
33
|
+
getS3Rules() {
|
|
34
|
+
return this.s3Rules;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.CORS = CORS;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare enum Environment {
|
|
2
|
-
Production = 0,
|
|
3
|
-
Testing = 1
|
|
4
|
-
}
|
|
1
|
+
export declare enum Environment {
|
|
2
|
+
Production = 0,
|
|
3
|
+
Testing = 1
|
|
4
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Environment = void 0;
|
|
4
|
-
var Environment;
|
|
5
|
-
(function (Environment) {
|
|
6
|
-
Environment[Environment["Production"] = 0] = "Production";
|
|
7
|
-
Environment[Environment["Testing"] = 1] = "Testing";
|
|
8
|
-
})(Environment = exports.Environment || (exports.Environment = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Environment = void 0;
|
|
4
|
+
var Environment;
|
|
5
|
+
(function (Environment) {
|
|
6
|
+
Environment[Environment["Production"] = 0] = "Production";
|
|
7
|
+
Environment[Environment["Testing"] = 1] = "Testing";
|
|
8
|
+
})(Environment = exports.Environment || (exports.Environment = {}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './environment';
|
|
2
|
-
export * from './scope';
|
|
1
|
+
export * from './environment';
|
|
2
|
+
export * from './scope';
|
|
@@ -1,18 +1,18 @@
|
|
|
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("./environment"), exports);
|
|
18
|
-
__exportStar(require("./scope"), exports);
|
|
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("./environment"), exports);
|
|
18
|
+
__exportStar(require("./scope"), exports);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare enum Scope {
|
|
2
|
-
Student = 0,
|
|
3
|
-
UniAdmin = 1
|
|
4
|
-
}
|
|
1
|
+
export declare enum Scope {
|
|
2
|
+
Student = 0,
|
|
3
|
+
UniAdmin = 1
|
|
4
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Scope = void 0;
|
|
4
|
-
var Scope;
|
|
5
|
-
(function (Scope) {
|
|
6
|
-
Scope[Scope["Student"] = 0] = "Student";
|
|
7
|
-
Scope[Scope["UniAdmin"] = 1] = "UniAdmin";
|
|
8
|
-
})(Scope = exports.Scope || (exports.Scope = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Scope = void 0;
|
|
4
|
+
var Scope;
|
|
5
|
+
(function (Scope) {
|
|
6
|
+
Scope[Scope["Student"] = 0] = "Student";
|
|
7
|
+
Scope[Scope["UniAdmin"] = 1] = "UniAdmin";
|
|
8
|
+
})(Scope = exports.Scope || (exports.Scope = {}));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './cors';
|
|
2
|
-
export * from './allowed-domain-reg-ex-list';
|
|
3
|
-
export * from './enums';
|
|
1
|
+
export * from './cors';
|
|
2
|
+
export * from './allowed-domain-reg-ex-list';
|
|
3
|
+
export * from './enums';
|
|
@@ -1,19 +1,19 @@
|
|
|
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("./cors"), exports);
|
|
18
|
-
__exportStar(require("./allowed-domain-reg-ex-list"), exports);
|
|
19
|
-
__exportStar(require("./enums"), exports);
|
|
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("./cors"), exports);
|
|
18
|
+
__exportStar(require("./allowed-domain-reg-ex-list"), exports);
|
|
19
|
+
__exportStar(require("./enums"), exports);
|