Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/ffdc 3331 region specific redirect uri #317

Open
wants to merge 28 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a059f9c
remove global logger, add logs to login flow, error logs, one omslogg…
Aug 12, 2024
13d949a
server instance id as injection token, injecting generic logger class
Aug 12, 2024
b8329d4
server instance id injection token, dynamic module configuration
Aug 13, 2024
0ac8e73
tests, console.log logger method
Aug 13, 2024
f384b39
oidc module test
Aug 13, 2024
48e8d6c
remove req.body and req.headers logging, http exception filer name, i…
Aug 21, 2024
ebab114
remove instance id from oidc module, remove logging of res.body
Aug 22, 2024
66f3114
instance id passed trough config service
Sep 10, 2024
3e93ee2
fix tests
Sep 10, 2024
69f61d4
session logging, restore httpexceptionfilter, added logging to differ…
Sep 18, 2024
7c73c9b
remove req.session from log
Sep 30, 2024
92a2693
region specific redirect uri, logging
Oct 1, 2024
332e3ab
Merge branch 'develop' into bugfix/FFDC-3331-region-specific-redirect…
Oct 2, 2024
d6e5e47
update package.lock
Oct 2, 2024
3f01c98
remove fallback method for wrong region, log method object parameter,…
Oct 3, 2024
dd8f6b5
restore redirect_uri setup logic
Oct 4, 2024
7f0ed8e
login callback separate logic, session log in exception filter, manua…
Oct 22, 2024
a05d794
redirect to main dns with query from /login/callback
Oct 23, 2024
134afb5
redirect to main dns
Oct 24, 2024
2dbf428
remove sessionKey, disable redirect from regional url
Nov 6, 2024
a6e5426
set cookie domain, oidc session key, logging
Nov 15, 2024
9b226a6
test fix, remove most logs
Dec 2, 2024
6a518fb
update package-lock.json
Dec 3, 2024
611d535
fix main.ts for app build
Dec 5, 2024
e15cec7
update oidc package-lock
Dec 9, 2024
002cdac
rise github actions node version
Dec 10, 2024
cbaa903
fix for oidc module test undefined env variable
Dec 10, 2024
7242ba5
tests fix, rename private filds for tests
Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
package: [oidc, proxy, logger, ffdc-apis/corporate-accounts]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
package: [oidc, proxy, logger, ffdc-apis/corporate-accounts]

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [20.x]
package: [oidc, proxy, logger, ffdc-apis/corporate-accounts]

steps:
Expand Down
5 changes: 4 additions & 1 deletion libs/logger/src/interceptors/common-http.interceptor.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { createMock } from '@golevelup/nestjs-testing';
import { CallHandler, ExecutionContext } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { of } from 'rxjs';
import { HttpLoggingInterceptor } from './common-http.interceptor';

describe('HttpLoggingInterceptor', () => {
let interceptor;
let configService;

beforeEach(() => {
interceptor = new HttpLoggingInterceptor();
configService = new ConfigService();
interceptor = new HttpLoggingInterceptor(configService);
});

it('should be defined', () => {
Expand Down
10 changes: 8 additions & 2 deletions libs/logger/src/interceptors/common-http.interceptor.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
import { CallHandler, ExecutionContext, Injectable, Logger, NestInterceptor } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Observable } from 'rxjs';
import { tap } from 'rxjs/operators';

@Injectable()
export class HttpLoggingInterceptor implements NestInterceptor {
readonly logger = new Logger(HttpLoggingInterceptor.name);
#instanceID: string;

constructor(configService: ConfigService) {
this.#instanceID = configService.get('SERVER_INSTANCE_ID');
}

intercept(context: ExecutionContext, next: CallHandler): Observable<any> {
let req = context.switchToHttp().getRequest();
let log = false;

if (context['contextType'] !== 'graphql') {
log = true;
this.logger.log(`START: ${context.getClass().name}.${context.getHandler().name}(): ${req.method} ${req.url}`);
this.logger.log(`START: ${context.getClass().name}.${context.getHandler().name}(): ${req.method} ${req.url} instanceID: ${this.#instanceID}`);
}

return next.handle().pipe(
tap(() => {
if (log) {
this.logger.log(`STOP: ${context.getClass().name}.${context.getHandler().name}(): ${req.method} ${req.url}`);
this.logger.log(`STOP: ${context.getClass().name}.${context.getHandler().name}(): ${req.method} ${req.url} instanceID: ${this.#instanceID}`);
}
}),
);
Expand Down
8 changes: 5 additions & 3 deletions libs/logger/src/logger.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { Module } from '@nestjs/common';
import { OMSLogger } from './oms/oms.logger.service';

@Module({
providers: [ OMSLogger ],
exports: [ OMSLogger ],
providers: [
OMSLogger
],
exports: [OMSLogger],
})
export class LoggerModule {}
export class LoggerModule { }
9 changes: 7 additions & 2 deletions libs/logger/src/oms/oms.logger.service.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { OMSLogger } from './oms.logger.service';

describe('OMSLogger', () => {
let service: OMSLogger;
let configService: ConfigService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [OMSLogger],
providers: [OMSLogger, ConfigService],
}).compile();

service = await module.resolve<OMSLogger>(OMSLogger);
configService = await module.resolve<ConfigService>(ConfigService);
jest.spyOn(console, 'log').mockImplementation(() => 'test');

process.stdout.isTTY = false;
Expand Down Expand Up @@ -52,13 +55,15 @@ describe('OMSLogger', () => {

describe('OMSLogger - with mocked interactive console', () => {
let service: OMSLogger;
let configService: ConfigService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
providers: [OMSLogger],
providers: [OMSLogger, ConfigService],
}).compile();

service = await module.resolve<OMSLogger>(OMSLogger);
configService = await module.resolve<ConfigService>(ConfigService);
jest.spyOn(console, 'log').mockImplementation(() => 'test');

process.stdout.isTTY = true;
Expand Down
10 changes: 9 additions & 1 deletion libs/logger/src/oms/oms.logger.service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { ConsoleLogger, Injectable, Scope } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { OMSLogLevel } from './OMSLog.interface';

@Injectable({ scope: Scope.TRANSIENT })
export class OMSLogger extends ConsoleLogger {
#instanceID: string;
constructor(private configService: ConfigService) {
super();
this.#instanceID = configService.get('SERVER_INSTANCE_ID');
}

private print(logLevel: OMSLogLevel, message: string, context?: string, stackTrace?: string) {
let currentContext = context;
if (typeof context === 'undefined') {
Expand All @@ -15,6 +22,7 @@ export class OMSLogger extends ConsoleLogger {
msg: message,
logger: currentContext,
stack_trace: stackTrace,
instanceID: this.#instanceID,
};

console.log(JSON.stringify(logEntry));
Expand All @@ -41,4 +49,4 @@ export class OMSLogger extends ConsoleLogger {
verbose(message: string, context?: string) {
process.stdout.isTTY ? super.verbose.apply(this, arguments) : this.print(OMSLogLevel.VERBOSE, message, context);
}
}
}
Loading
Loading