SSO/SAML : add Base URL to redirects in acsHandler (#5923)

add Base URL to redirects in acsHandler

I modified the redirections to include the base URL of the instance so that the redirects remain correct even if the instance is accessed from a subdirectory.

Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
This commit is contained in:
Jimw383 2023-04-24 12:36:50 +02:00 committed by GitHub
parent 57aab63c10
commit 03be725cef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,5 @@
import express from 'express';
import { getInstanceBaseUrl } from '@/UserManagement/UserManagementHelper';
import { Authorized, Get, Post, RestController } from '@/decorators';
import { SamlUrls } from '../constants';
import {
@ -125,9 +126,9 @@ export class SamlController {
if (isSamlLicensedAndEnabled()) {
await issueCookie(res, loginResult.authenticatedUser);
if (loginResult.onboardingRequired) {
return res.redirect(SamlUrls.samlOnboarding);
return res.redirect(getInstanceBaseUrl() + SamlUrls.samlOnboarding);
} else {
return res.redirect(SamlUrls.defaultRedirect);
return res.redirect(getInstanceBaseUrl() + SamlUrls.defaultRedirect);
}
} else {
return res.status(202).send(loginResult.attributes);