mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-14 04:27:34 +00:00
reorganize imports
This commit is contained in:
@@ -66,19 +66,6 @@ async function loadSessions({
|
||||
return response?.sessions ?? [];
|
||||
}
|
||||
|
||||
export function constructUrl(request: NextRequest, path: string) {
|
||||
const forwardedHost =
|
||||
request.headers.get("x-zitadel-forward-host") ??
|
||||
request.headers.get("host");
|
||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
||||
return new URL(
|
||||
`${basePath}${path}`,
|
||||
forwardedHost?.startsWith("http")
|
||||
? forwardedHost
|
||||
: `https://${forwardedHost}`,
|
||||
);
|
||||
}
|
||||
|
||||
const ORG_SCOPE_REGEX = /urn:zitadel:iam:org:id:([0-9]+)/;
|
||||
const ORG_DOMAIN_SCOPE_REGEX = /urn:zitadel:iam:org:domain:primary:(.+)/; // TODO: check regex for all domain character options
|
||||
const IDP_SCOPE_REGEX = /urn:zitadel:iam:org:idp:id:(.+)/;
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import { constructUrl } from "@/app/login/route";
|
||||
import { Cookie } from "@/lib/cookies";
|
||||
import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
|
||||
import { createCallback, getLoginSettings } from "@/lib/zitadel";
|
||||
@@ -9,6 +8,7 @@ import {
|
||||
} from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
|
||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { constructUrl } from "./service";
|
||||
import { isSessionValid } from "./session";
|
||||
|
||||
type LoginWithOIDCandSession = {
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import { constructUrl } from "@/app/login/route";
|
||||
import { Cookie } from "@/lib/cookies";
|
||||
import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
|
||||
import { createResponse, getLoginSettings } from "@/lib/zitadel";
|
||||
@@ -6,6 +5,7 @@ import { create } from "@zitadel/client";
|
||||
import { CreateResponseRequestSchema } from "@zitadel/proto/zitadel/saml/v2/saml_service_pb";
|
||||
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { constructUrl } from "./service";
|
||||
import { isSessionValid } from "./session";
|
||||
|
||||
type LoginWithSAMLandSession = {
|
||||
|
@@ -8,6 +8,7 @@ import { SessionService } from "@zitadel/proto/zitadel/session/v2/session_servic
|
||||
import { SettingsService } from "@zitadel/proto/zitadel/settings/v2/settings_service_pb";
|
||||
import { UserService } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
|
||||
import { ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapters/headers";
|
||||
import { NextRequest } from "next/server";
|
||||
import { systemAPIToken } from "./api";
|
||||
|
||||
type ServiceClass =
|
||||
@@ -108,3 +109,16 @@ export function getServiceUrlFromHeaders(headers: ReadonlyHeaders): {
|
||||
serviceUrl: instanceUrl,
|
||||
};
|
||||
}
|
||||
|
||||
export function constructUrl(request: NextRequest, path: string) {
|
||||
const forwardedHost =
|
||||
request.headers.get("x-zitadel-forward-host") ??
|
||||
request.headers.get("host");
|
||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
|
||||
return new URL(
|
||||
`${basePath}${path}`,
|
||||
forwardedHost?.startsWith("http")
|
||||
? forwardedHost
|
||||
: `https://${forwardedHost}`,
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user