mirror of
http://172.20.10.11:3000/gitadmin/INSIGHT-MVP.git
synced 2026-06-25 00:16:41 +02:00
fix(ms365): HTTPS-Protokoll für Integration-Redirect-URI erzwingen
Traefik leitet x-forwarded-proto nicht korrekt weiter, sodass der Controller http:// statt https:// generierte — Azure lehnt nicht-HTTPS Redirect-URIs für nicht-localhost ab (AADSTS50011). Protokoll wird jetzt aus der konfigurierten SSO-Redirect-URI abgeleitet (immer HTTPS), der Host bleibt dynamisch (IP oder DNS). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1f6e59d362
commit
82e6a03bb9
1 changed files with 9 additions and 2 deletions
|
|
@ -65,9 +65,16 @@ export class IntegrationsController {
|
||||||
@Req() req: Request,
|
@Req() req: Request,
|
||||||
): Promise<{ success: boolean; data: { url: string } }> {
|
): Promise<{ success: boolean; data: { url: string } }> {
|
||||||
// Redirect-URI dynamisch aus dem Anfrage-Host ableiten
|
// Redirect-URI dynamisch aus dem Anfrage-Host ableiten
|
||||||
// Unterstuetzt sowohl IP als auch DNS-Name (z.B. insight.xinion.lan)
|
// Protokoll: aus der konfigurierten SSO-URI (HTTPS) — Azure akzeptiert nur HTTPS
|
||||||
|
// fuer nicht-localhost URIs. x-forwarded-proto koennte http sein (Traefik-intern).
|
||||||
const host = (req.get('x-forwarded-host') || req.get('host') || '').split(',')[0].trim();
|
const host = (req.get('x-forwarded-host') || req.get('host') || '').split(',')[0].trim();
|
||||||
const proto = req.get('x-forwarded-proto') || req.protocol || 'http';
|
const configuredUri = this.entraIdService.getIntegrationRedirectUri();
|
||||||
|
let proto = 'https';
|
||||||
|
try {
|
||||||
|
proto = new URL(configuredUri).protocol.replace(':', '');
|
||||||
|
} catch {
|
||||||
|
proto = req.get('x-forwarded-proto') || 'https';
|
||||||
|
}
|
||||||
const redirectUri = host
|
const redirectUri = host
|
||||||
? `${proto}://${host}/api/v1/auth/integrations/microsoft-365/callback`
|
? `${proto}://${host}/api/v1/auth/integrations/microsoft-365/callback`
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue