Skip to content

Commit

Permalink
WIP: adding OIDC controller
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlatz committed Feb 25, 2024
1 parent 9a943f9 commit 3d161b0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions server/src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import { PrismaClient } from '@prisma/client';
import ShipRepository from './repositories/ShipRepository';
import LocationRepository from './repositories/LocationRepository';
import EventRepository from './repositories/EventRepository';
import { openIDConnectServiceFactory } from './services/OpenIdConnectService';
import { OpenIdConnectController } from './controllers/OpenIdConnectController';
import OpenIdConnectService from './services/OpenIdConnectService';

@Module({
imports: [],
controllers: [ShipController],
controllers: [ShipController, OpenIdConnectController],
providers: [
PrismaClient,
ShipRepository,
Expand Down
19 changes: 19 additions & 0 deletions server/src/controllers/OpenIdConnectController.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { Controller, Get, Inject, Res } from '@nestjs/common';
import { Response } from 'express';

import OpenIdConnectService from '../services/OpenIdConnectService';

@Controller()
export class OpenIdConnectController {
constructor(
@Inject('OPEN_ID_CONNECT_SERVICE')
private readonly openIdConnectService: OpenIdConnectService,
) {}

@Get('api/openid/login')
async login(@Res() res: Response): Promise<void> {
const authorizationUrl = this.openIdConnectService.getAuthorizationUrl();

res.redirect(authorizationUrl);
}
}

0 comments on commit 3d161b0

Please sign in to comment.