diff --git a/apps/api/src/oidc/oidc-interaction.controller.ts b/apps/api/src/oidc/oidc-interaction.controller.ts index 55d672c..5cb945d 100644 --- a/apps/api/src/oidc/oidc-interaction.controller.ts +++ b/apps/api/src/oidc/oidc-interaction.controller.ts @@ -1,10 +1,14 @@ import { Body, Controller, Get, Param, Post, Req, Res, UnauthorizedException } from '@nestjs/common'; +import { ConfigService } from '@nestjs/config'; import { Request, Response } from 'express'; import { OidcProviderService } from './oidc-provider.service'; @Controller('interaction') export class OidcInteractionController { - constructor(private readonly oidc: OidcProviderService) {} + constructor( + private readonly oidc: OidcProviderService, + private readonly config: ConfigService, + ) {} @Get(':uid') async view(@Param('uid') uid: string, @Req() request: Request, @Res() response: Response) { @@ -15,6 +19,7 @@ export class OidcInteractionController { } if (details.prompt.name === 'login') { + response.send( this.page( 'Anmelden', @@ -25,6 +30,7 @@ export class OidcInteractionController { } if (details.prompt.name === 'consent') { + console.log(details) response.send( this.page( 'Zugriff erlauben', @@ -94,6 +100,7 @@ export class OidcInteractionController {
+ `; } @@ -113,6 +120,9 @@ export class OidcInteractionController { input { border: 1px solid #bcc8d3; border-radius: 6px; font: inherit; min-height: 44px; padding: 10px 12px; } button { background: #0f6b6e; border: 1px solid #0f6b6e; border-radius: 6px; color: white; cursor: pointer; font: inherit; font-weight: 700; min-height: 44px; padding: 10px 14px; } button.secondary { background: white; color: #0f6b6e; } + a { color: #0f6b6e; font-weight: 700; text-decoration: none; } + a:hover { text-decoration: underline; } + .form-link { margin: 16px 0 0; text-align: center; } .message { background: #edf7f4; border: 1px solid #b8ddd3; border-radius: 6px; color: #24564f; margin: 0 0 16px; padding: 12px; } .message.error { background: #fff1f0; border-color: #efb5ae; color: #8d2b20; } .scopes { background: #edf2f5; border-radius: 6px; padding: 10px; word-break: break-word; } @@ -131,6 +141,11 @@ export class OidcInteractionController { .replaceAll("'", '''); } + private get registrationUrl(): string { + const publicWebUrl = this.config.get('PUBLIC_WEB_URL') ?? 'http://localhost:4200'; + return `${publicWebUrl.replace(/\/+$/, '')}/register`; + } + private isInvalidCredentialsError(error: unknown): boolean { return error instanceof UnauthorizedException && error.message === 'Ungültige Zugangsdaten.'; }