Skip to content

Commit

Permalink
Building lib + flexible consumer key
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAnhNguyenFOKUSFAME committed Feb 25, 2025
1 parent df25b71 commit ff25795
Show file tree
Hide file tree
Showing 77 changed files with 412 additions and 92 deletions.
14 changes: 10 additions & 4 deletions .env.default
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ PORT=3001
# URL WHERE THE REVERSE PROXY OF THE CLM-MICROSERVICES IS
DEPLOY_URL=http://localhost:3001

# ADMIN LTI TOOL
UES_BASIC_LAUNCH_RESSOURCE=/basic_launch/adminService

# MARIADB CONFIGURATION mapps to
MARIA_CONFIG=localhost|3306|clm|root|12345

# CLM_ROOT_USER
[email protected]
# USERNAME OF THE CLM ROOT USER OF THE CLM. WILL BE CREATED AT FIRST STARTUP
CLM_ROOT_USER=

# PASSWORD OF THE ROOT USER OF THE CLM. WILL BE CREATED AT FIRST STARTUP
CLM_ROOT_PASSWORD=

# CLM_ROOT_PASSWORD
CLM_ROOT_PASSWORD=ABC123
# CONSUMER TOKEN FOR AUTHENTICATION AGAINST CLM. WILL BE CREATED AT FIRST STARTUP
CLM_CONSUMER_TOKEN=

# SMTP HOST/CREDENTIALS/CONFIGS FOR RECEIVING EMAILS WHEN REGISTERING. Do not leave blank in production!
SMTP_HOST=
Expand Down
2 changes: 1 addition & 1 deletion api-docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ servers:
hostname:
default: localhost
port:
default: '5008'
default: '80'
path:
default: ''
scheme:
Expand Down
2 changes: 1 addition & 1 deletion dist/server.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions dist/server.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.ROOT_DIR = void 0;
/* -----------------------------------------------------------------------------
* Copyright (c) 2023, Fraunhofer-Gesellschaft zur Förderung der angewandten Forschung e.V.
*
Expand Down Expand Up @@ -80,7 +75,7 @@ app.set('view engine', 'ejs');
app.use(basePath, EntryPointController_1.default);
app.use(ErrorHandler_1.default);
(0, configureDeps_1.default)(app, EXCLUDED_PATHS).then(() => app.listen(PORT, () => {
console.info(`Listening for core on port ${PORT}`);
console.info('Listening for core');
})).catch((err) => {
console.error(JSON.stringify(err));
});
3 changes: 2 additions & 1 deletion dist/src/config/config.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export declare const CONFIG: {
BASE_PATH: string;
CLM_ROOT_USER: string;
CLM_ROOT_PASSWORD: string;
CLM_ROOT_CONSUMER_KEY: string;
DEPLOY_URL: string;
SMTP_FROM: string;
SMTP_HOST: string;
Expand All @@ -18,6 +19,6 @@ export declare const CONFIG: {
TOKEN_SECRET: string;
REDIS_CONFIG: string;
OIDC_PROVIDERS: any;
API_TOKEN: string;
ODIC_CLIENTS: any;
};
//# sourceMappingURL=config.d.ts.map
2 changes: 1 addition & 1 deletion dist/src/config/config.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion dist/src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ exports.CONFIG = {
BASE_PATH: process.env.BASE_PATH || '/core',
CLM_ROOT_USER: process.env.CLM_ROOT_USER || '[email protected]',
CLM_ROOT_PASSWORD: process.env.CLM_ROOT_PASSWORD || 'ABC123',
CLM_ROOT_CONSUMER_KEY: process.env.CLM_ROOT_CONSUMER_KEY || 'MGMT_SERVICE',
DEPLOY_URL: process.env.DEPLOY_URL || 'http://localhost/api',
SMTP_FROM: process.env.SMTP_FROM || '',
SMTP_HOST: process.env.SMTP_HOST || '',
Expand All @@ -50,5 +51,5 @@ exports.CONFIG = {
TOKEN_SECRET: process.env.TOKEN_SECRET || 'secret',
REDIS_CONFIG: process.env.REDIS_CONFIG || 'localhost|6379',
OIDC_PROVIDERS: JSON.parse(process.env.OIDC_PROVIDERS || `[]`),
API_TOKEN: process.env.API_TOKEN || 'MGMT_SERVICE'
ODIC_CLIENTS: JSON.parse(process.env.OIDC_CLIENTS || `[]`),
};
2 changes: 1 addition & 1 deletion dist/src/config/configureDeps.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/config/configureDeps.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function configureDependencies(app, excludedPaths) {
strength: 3,
immutable: true
}));
yield PathBDTO_1.pathBDTOInstance.registerRoutes(app, excludedPaths, config_1.CONFIG.API_TOKEN, rootUser);
yield PathBDTO_1.pathBDTOInstance.registerRoutes(app, excludedPaths, config_1.CONFIG.CLM_ROOT_CONSUMER_KEY, rootUser);
let user = (yield UserDAO_1.default.findByAttributes({ email: rootUser }))[0];
if (!user)
UserDAO_1.default.insert(new UserModel_1.UserModel({
Expand Down
2 changes: 1 addition & 1 deletion dist/src/config/databaseTables.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/AuthController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions dist/src/controllers/AuthController.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const axios_1 = __importDefault(require("axios"));
const express_1 = __importDefault(require("express"));
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
const config_1 = require("../config/config");
const UserDAO_1 = __importDefault(require("../models/User/UserDAO"));
const passport_1 = __importDefault(require("../passport/passport"));
const jwtService_1 = require("../services/jwtService");
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
const UserDAO_1 = __importDefault(require("../models/User/UserDAO"));
const config_1 = require("../config/config");
const axios_1 = __importDefault(require("axios"));
const OIDC_PROVIDERS = config_1.CONFIG.OIDC_PROVIDERS;
const basePath = config_1.CONFIG.BASE_PATH || '/core';
const baseLocation = `${basePath}/authentication`;
class AuthController {
constructor() {
this.authenticateUser = (req, res, next) => {
Expand Down
2 changes: 1 addition & 1 deletion dist/src/controllers/BaseExtensionCtrl.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/BaseModelController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/EntryPointController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions dist/src/controllers/EntryPointController.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const express_1 = __importDefault(require("express"));
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
const swagger_jsdoc_1 = __importDefault(require("swagger-jsdoc"));
const config_1 = require("../config/config");
const CoreLib_1 = require("../lib/CoreLib");
const UserDAO_1 = __importDefault(require("../models/User/UserDAO"));
const AuthController_1 = __importDefault(require("./AuthController"));
const MgmtRoleController_1 = __importDefault(require("./MgmtRoleController"));
const MgtmAPITokenController_1 = __importDefault(require("./MgtmAPITokenController"));
const MgtmGroupController_1 = __importDefault(require("./MgtmGroupController"));
const MgtmUserController_1 = __importDefault(require("./MgtmUserController"));
Expand Down Expand Up @@ -151,9 +146,13 @@ const EXCLUDED_PATHS = [
`${basePath}/roles/:id`,
`${basePath}/users/verifyToken/:tokenId`,
`${basePath}/mgmt/consumers/:id/confirm`,
`${basePath}/sso/oidc`,
`${basePath}/sso/success`,
`${basePath}/sso/oidc/backend/login`,
`${basePath}/sso/oidc/access_token_by_code`,
`/health`
];
EntryPointController.use('/sso/oidc', OIDCController_1.default.router);
EntryPointController.use(CoreLib_1.AuthGuard.requireAPIToken(EXCLUDED_PATHS));
EntryPointController.use('/resources', ResourceController_1.default.router);
// CONFIG.DISABLE_LEGACCY_FINDOO = true
Expand Down
2 changes: 1 addition & 1 deletion dist/src/controllers/MgmtRoleController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/MgtmAPITokenController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/MgtmGroupController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/src/controllers/MgtmUserController.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions dist/src/controllers/OIDCController.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import express from 'express';
import { UserModel } from '../lib/CoreLib';
declare class OIDController {
router: express.Router;
constructor();
init(): void;
brokerLogout: express.Handler;
brokerLogoutRedirect: express.Handler;
ssoLanding: express.Handler;
ssoBackendLogin: express.Handler;
codeAuthFlow: (code: string) => Promise<{
user: UserModel;
access_token: any;
refresh_token: any;
expires_in: any;
refresh_expires_in: any;
}>;
getAccessTokenByCode: express.Handler;
ssoSuccess: express.Handler;
}
declare const _default: OIDController;
export default _default;
//# sourceMappingURL=OIDCController.d.ts.map
Loading

0 comments on commit ff25795

Please sign in to comment.