fix(login): prettier setup (#11798)

# Which Problems Are Solved
Invalid formatting in the login codebase due to invalid prettier
configuration

# How the Problems Are Solved
Fxed .prettierignore wildcards for login source files

# Additional Changes
Removed .prettierrc file because there is already a prettier.config.mjs
file

# Additional Context
This commit is contained in:
Ramon
2026-03-10 13:30:20 +00:00
committed by GitHub
parent 33c635fbc3
commit 057fb8dff2
156 changed files with 761 additions and 1231 deletions
+1 -3
View File
@@ -15,9 +15,7 @@ export async function systemAPIToken() {
const token = {
audience: process.env.AUDIENCE,
userID: process.env.SYSTEM_USER_ID,
token: Buffer.from(process.env.SYSTEM_USER_PRIVATE_KEY, "base64").toString(
"utf-8",
),
token: Buffer.from(process.env.SYSTEM_USER_PRIVATE_KEY, "base64").toString("utf-8"),
};
return newSystemToken({
+2 -2
View File
@@ -1,5 +1,5 @@
import { describe, it, expect } from "vitest";
import { validateAuthRequest, isRSCRequest, isValidLanguage, getValidLocaleFromUILocales } from "./auth-utils";
import { describe, expect, it } from "vitest";
import { getValidLocaleFromUILocales, isRSCRequest, isValidLanguage, validateAuthRequest } from "./auth-utils";
describe("auth-utils", () => {
describe("isValidLanguage", () => {
+5 -4
View File
@@ -50,10 +50,11 @@ export function getValidLocaleFromUILocales(uiLocales: string[] | undefined): st
export function validateAuthRequest(searchParams: URLSearchParams): string | null {
const oidcRequestId = searchParams.get("authRequest");
const samlRequestId = searchParams.get("samlRequest");
const requestId = searchParams.get("requestId") ??
const requestId =
searchParams.get("requestId") ??
(oidcRequestId ? `oidc_${oidcRequestId}` : samlRequestId ? `saml_${samlRequestId}` : undefined);
return requestId || null;
}
@@ -62,4 +63,4 @@ export function validateAuthRequest(searchParams: URLSearchParams): string | nul
*/
export function isRSCRequest(searchParams: URLSearchParams): boolean {
return searchParams.has("_rsc");
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, test, vi, beforeEach } from "vitest";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { isSafeRedirectUri } from "./client-utils";
describe("isSafeRedirectUri", () => {
+1 -1
View File
@@ -61,4 +61,4 @@ export function isSafeRedirectUri(uri: string): boolean {
// If it can't be parsed as a URL and didn't start with /, it's unsafe
return false;
}
}
}
+1 -3
View File
@@ -1,4 +1,4 @@
import { describe, expect, test, vi, beforeEach } from "vitest";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { getNextUrl } from "./client";
// Mock next/headers
@@ -52,5 +52,3 @@ describe("getNextUrl", () => {
expect(result).toBe("/signedin?loginName=test-user");
});
});
+1 -2
View File
@@ -1,9 +1,9 @@
"use server";
import { headers } from "next/headers";
import { isSafeRedirectUri } from "./client-utils";
import { completeAuthFlow } from "./server/auth-flow";
import { getPublicHostWithProtocol } from "./server/host";
import { isSafeRedirectUri } from "./client-utils";
type FinishFlowCommand =
| {
@@ -153,4 +153,3 @@ export async function resolveRedirectUri(command: FinishFlowCommand, defaultRedi
console.log("resolveRedirectUri: Using relative goToSignedInPage result:", result);
return result;
}
+8 -8
View File
@@ -1,21 +1,21 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
Cookie,
addSessionToCookie,
updateSessionCookie,
removeSessionFromCookie,
getAllSessionCookieIds,
getAllSessions,
getLanguageCookie,
getMostRecentCookieWithLoginname,
getMostRecentSessionCookie,
getSessionCookieById,
getSessionCookieByLoginName,
getAllSessionCookieIds,
getAllSessions,
getMostRecentCookieWithLoginname,
removeSessionFromCookie,
setLanguageCookie,
getLanguageCookie,
updateSessionCookie,
} from "./cookies";
import { cookies } from "next/headers";
import { timestampDate, timestampFromMs } from "@zitadel/client";
import { cookies } from "next/headers";
// Mock logger - use vi.hoisted to ensure it's defined before vi.mock runs
const mockLogger = vi.hoisted(() => ({
-1
View File
@@ -1,4 +1,3 @@
const BASE_DIRECTIVES: Record<string, string[]> = {
"default-src": ["'self'"],
"script-src": ["'self'", "'unsafe-inline'", "'unsafe-eval'"],
+2 -2
View File
@@ -1,5 +1,5 @@
import { describe, expect, test, beforeEach, afterEach } from "vitest";
import { hasSystemUserCredentials, hasServiceUserToken, hasLoginServiceKey, getLoginSystemUserId } from "./deployment";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { getLoginSystemUserId, hasLoginServiceKey, hasServiceUserToken, hasSystemUserCredentials } from "./deployment";
describe("Deployment utilities", () => {
const originalEnv = process.env;
+3 -3
View File
@@ -1,16 +1,16 @@
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest";
import { v4 as uuidv4 } from "uuid";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import {
getFingerprintId,
setFingerprintIdCookie,
getFingerprintIdCookie,
getOrSetFingerprintId,
getUserAgent,
setFingerprintIdCookie,
} from "./fingerprint";
import { create } from "@zitadel/client";
import { cookies, headers } from "next/headers";
import { userAgent } from "next/server";
import { create } from "@zitadel/client";
// Mock dependencies
vi.mock("uuid");
+1 -4
View File
@@ -1,8 +1,5 @@
import { create } from "@zitadel/client";
import {
UserAgent,
UserAgentSchema,
} from "@zitadel/proto/zitadel/session/v2/session_pb";
import { UserAgent, UserAgentSchema } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { cookies, headers } from "next/headers";
import { userAgent } from "next/server";
import { v4 as uuidv4 } from "uuid";
@@ -1,9 +1,6 @@
import { SpanKind, SpanStatusCode } from "@opentelemetry/api";
import { resourceFromAttributes } from "@opentelemetry/resources";
import {
InMemorySpanExporter,
SimpleSpanProcessor,
} from "@opentelemetry/sdk-trace-base";
import { InMemorySpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
import { afterAll, beforeEach, describe, expect, it } from "vitest";
import { otelGrpcInterceptor } from "./otel";
@@ -34,9 +31,7 @@ describe("otelGrpcInterceptor", () => {
},
});
expect(capturedHeaders["traceparent"]).toMatch(
/^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/,
);
expect(capturedHeaders["traceparent"]).toMatch(/^[0-9a-f]{2}-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}$/);
});
it("creates client spans with RPC attributes", async () => {
+2 -9
View File
@@ -19,13 +19,7 @@
* ```
*/
import {
context,
propagation,
SpanKind,
SpanStatusCode,
trace,
} from "@opentelemetry/api";
import { context, propagation, SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
import { GrpcError, Interceptor } from "./types";
const TRACER_NAME = "zitadel-login-grpc" as const;
@@ -77,8 +71,7 @@ export function otelGrpcInterceptor(next: Parameters<Interceptor>[0]): ReturnTyp
span.setStatus({ code: SpanStatusCode.OK });
return response;
} catch (err: unknown) {
const exception =
err instanceof Error ? err : new Error(String(err));
const exception = err instanceof Error ? err : new Error(String(err));
span.recordException(exception);
const grpcError = err as GrpcError;
if (grpcError.code !== undefined) {
@@ -13,6 +13,4 @@ export interface GrpcError extends Error {
readonly code?: number;
}
export type Interceptor<T = unknown> = (
next: (req: GrpcRequest) => Promise<T>,
) => (req: GrpcRequest) => Promise<T>;
export type Interceptor<T = unknown> = (next: (req: GrpcRequest) => Promise<T>) => (req: GrpcRequest) => Promise<T>;
-1
View File
@@ -61,7 +61,6 @@ export const LANGS: Lang[] = [
export const LANGUAGE_COOKIE_NAME = "NEXT_LOCALE";
export const LANGUAGE_HEADER_NAME = "accept-language";
export function shouldUILocalesOverrideCookie(): boolean {
return process.env.ZITADEL_UI_LOCALES_OVERRIDE_COOKIE === "true";
}
+2 -2
View File
@@ -1,7 +1,7 @@
import { describe, it, expect } from "vitest";
import { idpTypeToSlug, idpTypeToIdentityProviderType } from "./idp";
import { IDPType } from "@zitadel/proto/zitadel/idp/v2/idp_pb";
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { describe, expect, it } from "vitest";
import { idpTypeToIdentityProviderType, idpTypeToSlug } from "./idp";
describe("idp type mapping utilities", () => {
describe("idpTypeToSlug", () => {
+1 -3
View File
@@ -34,9 +34,7 @@ export function idpTypeToSlug(idpType: IdentityProviderType) {
}
// TODO: this is ugly but needed atm as the getIDPByID returns a IDPType and not a IdentityProviderType
export function idpTypeToIdentityProviderType(
idpType: IDPType,
): IdentityProviderType {
export function idpTypeToIdentityProviderType(idpType: IDPType): IdentityProviderType {
switch (idpType) {
case IDPType.IDP_TYPE_GITHUB:
return IdentityProviderType.GITHUB;
+1 -4
View File
@@ -60,10 +60,7 @@ export const logger = winston.createLogger({
* @param metadata - Optional additional metadata to include in all log messages
* @returns A child logger instance
*/
export function createLogger(
context: string,
metadata?: Record<string, unknown>,
): winston.Logger {
export function createLogger(context: string, metadata?: Record<string, unknown>): winston.Logger {
return logger.child({ context, ...metadata });
}
+14 -30
View File
@@ -1,5 +1,5 @@
import "server-only";
import { metrics } from "@opentelemetry/api";
import "server-only";
const serviceName = process.env.OTEL_SERVICE_NAME || "zitadel-login";
const meter = metrics.getMeter(serviceName);
@@ -8,13 +8,10 @@ const requestCounter = meter.createCounter("http_server_requests_total", {
description: "Total number of HTTP requests",
});
const requestDuration = meter.createHistogram(
"http_server_request_duration_seconds",
{
description: "HTTP request duration in seconds",
unit: "s",
},
);
const requestDuration = meter.createHistogram("http_server_request_duration_seconds", {
description: "HTTP request duration in seconds",
unit: "s",
});
const requestSize = meter.createHistogram("http_server_request_size_bytes", {
description: "Size of HTTP request bodies in bytes",
@@ -26,12 +23,9 @@ const responseSize = meter.createHistogram("http_server_response_size_bytes", {
unit: "By",
});
const responseStatusCounter = meter.createCounter(
"http_server_response_status_total",
{
description: "Count of HTTP responses per status code",
},
);
const responseStatusCounter = meter.createCounter("http_server_response_status_total", {
description: "Count of HTTP responses per status code",
});
const activeRequests = meter.createUpDownCounter("http_server_active_requests", {
description: "Number of active HTTP requests",
@@ -49,13 +43,10 @@ const authFailures = meter.createCounter("login_auth_failures_total", {
description: "Total failed authentications",
});
const sessionCreationDuration = meter.createHistogram(
"login_session_creation_duration_seconds",
{
description: "Session creation duration in seconds",
unit: "s",
},
);
const sessionCreationDuration = meter.createHistogram("login_session_creation_duration_seconds", {
description: "Session creation duration in seconds",
unit: "s",
});
/**
* Record an authentication attempt.
@@ -80,11 +71,7 @@ export function recordAuthSuccess(method: string, organization?: string): void {
/**
* Record a failed authentication.
*/
export function recordAuthFailure(
method: string,
reason: string,
organization?: string,
): void {
export function recordAuthFailure(method: string, reason: string, organization?: string): void {
authFailures.add(1, {
method,
reason,
@@ -135,10 +122,7 @@ export function recordRequestEnd(
/**
* Record session creation duration.
*/
export function recordSessionCreationDuration(
startTime: number,
success: boolean,
): void {
export function recordSessionCreationDuration(startTime: number, success: boolean): void {
const duration = (Date.now() - startTime) / 1000;
sessionCreationDuration.record(duration, {
success: success.toString(),
+2 -2
View File
@@ -1,8 +1,8 @@
import { describe, it, expect, beforeEach, vi } from "vitest";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { loginWithOIDCAndSession } from "./oidc";
import * as loginnameModule from "./server/loginname";
import * as sessionModule from "./session";
import * as zitadelModule from "./zitadel";
import * as loginnameModule from "./server/loginname";
vi.mock("./session");
vi.mock("./zitadel");
+1 -3
View File
@@ -12,7 +12,5 @@ export async function completeDeviceAuthorization(
const { serviceConfig } = getServiceConfig(_headers);
// without the session, device auth request is denied
return authorizeOrDenyDeviceAuthorization({ serviceConfig, deviceAuthorizationId,
session,
});
return authorizeOrDenyDeviceAuthorization({ serviceConfig, deviceAuthorizationId, session });
}
@@ -1,6 +1,6 @@
import { describe, expect, test, vi, beforeEach, afterEach } from "vitest";
import { NextRequest } from "next/server";
import { handleOIDCFlowInitiation, FlowInitiationParams } from "./flow-initiation";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { FlowInitiationParams, handleOIDCFlowInitiation } from "./flow-initiation";
vi.mock("@/lib/cookies", () => ({
getLanguageCookie: vi.fn(),
+3 -7
View File
@@ -1,6 +1,6 @@
import { getValidLocaleFromUILocales } from "@/lib/auth-utils";
import { shouldUILocalesOverrideCookie } from "@/lib/i18n";
import { getLanguageCookie, setLanguageCookie } from "@/lib/cookies";
import { shouldUILocalesOverrideCookie } from "@/lib/i18n";
import { idpTypeToSlug } from "@/lib/idp";
import { createLogger } from "@/lib/logger";
import { sendLoginname, SendLoginnameCommand } from "@/lib/server/loginname";
@@ -24,9 +24,9 @@ import { CreateResponseRequestSchema } from "@zitadel/proto/zitadel/saml/v2/saml
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { IdentityProviderType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { SecuritySettings } from "@zitadel/proto/zitadel/settings/v2/security_settings_pb";
import escapeHtml from "escape-html";
import { NextRequest, NextResponse } from "next/server";
import { buildCSP } from "../csp";
import escapeHtml from "escape-html";
const logger = createLogger("flow-initiation");
@@ -44,10 +44,7 @@ function setCSPHeaders(
? securitySettings.embeddedIframe.allowedOrigins
: undefined;
response.headers.set(
"Content-Security-Policy",
buildCSP({ serviceUrl: serviceConfig.baseUrl, iframeOrigins }),
);
response.headers.set("Content-Security-Policy", buildCSP({ serviceUrl: serviceConfig.baseUrl, iframeOrigins }));
if (!iframeOrigins) {
response.headers.set("X-Frame-Options", "deny");
@@ -198,7 +195,6 @@ export async function handleOIDCFlowInitiation(params: FlowInitiationParams): Pr
</html>
`;
return new NextResponse(html, {
headers: { "Content-Type": "text/html" },
});
+2 -2
View File
@@ -1,5 +1,5 @@
import { describe, expect, test, vi, beforeEach, afterEach } from "vitest";
import { getInstanceHost, getPublicHostWithProtocol, getPublicHost } from "./host";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { getInstanceHost, getPublicHost, getPublicHostWithProtocol } from "./host";
describe("Host utility functions", () => {
beforeEach(() => {
+2 -2
View File
@@ -1,7 +1,7 @@
import { describe, expect, test, vi, beforeEach, afterEach } from "vitest";
import { processIDPCallback } from "./idp-intent";
import { AutoLinkingOption } from "@zitadel/proto/zitadel/idp/v2/idp_pb";
import crypto from "crypto";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { processIDPCallback } from "./idp-intent";
// Mock all the dependencies
vi.mock("next/headers", () => ({
+5 -1
View File
@@ -124,7 +124,11 @@ interface IDPHandlerContext {
buildRedirectParams: (additionalParams?: Record<string, string>, includeToken?: boolean) => string;
}
type IDPHandlerResult = { redirect?: string; error?: string; samlData?: { url: string; fields: Record<string, string> } } | null;
type IDPHandlerResult = {
redirect?: string;
error?: string;
samlData?: { url: string; fields: Record<string, string> };
} | null;
/**
* CASE 1: Explicit Linking (via sessionId)
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, test, vi, beforeEach, afterEach } from "vitest";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { redirectToIdp } from "./idp";
// Mock all the dependencies
+1 -1
View File
@@ -4,9 +4,9 @@ import {
getLoginSettings,
getUserByID,
listAuthenticationMethodTypes,
ServiceConfig,
startIdentityProviderFlow,
startLDAPIdentityProviderFlow,
ServiceConfig,
} from "@/lib/zitadel";
import crypto from "crypto";
import { headers } from "next/headers";
+3 -3
View File
@@ -1,9 +1,9 @@
import { describe, expect, test, vi, beforeEach, afterEach } from "vitest";
import { sendLoginname } from "./loginname";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { PasskeysType } from "@zitadel/proto/zitadel/settings/v2/login_settings_pb";
import { UserState } from "@zitadel/proto/zitadel/user/v2/user_pb";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { getIDPByID } from "../zitadel";
import { sendLoginname } from "./loginname";
// Mock all the dependencies
vi.mock("next/headers", () => ({
+2 -5
View File
@@ -393,10 +393,7 @@ export async function sendLoginname(command: SendLoginnameCommand) {
};
case AuthenticationMethodType.PASSKEY: // AuthenticationMethodType.AUTHENTICATION_METHOD_TYPE_PASSKEY
if (
userLoginSettings?.passkeysType === PasskeysType.NOT_ALLOWED ||
!userLoginSettings?.allowLocalAuthentication
) {
if (userLoginSettings?.passkeysType === PasskeysType.NOT_ALLOWED || !userLoginSettings?.allowLocalAuthentication) {
if (command.ignoreUnknownUsernames) {
return preventUserEnumeration(command.organization);
}
@@ -504,7 +501,7 @@ export async function sendLoginname(command: SendLoginnameCommand) {
const matched = ORG_SUFFIX_REGEX.exec(command.loginName);
const suffix = matched?.[1] ?? "";
// this just returns orgs where the suffix is set as the Organization Domain
// this just returns orgs where the suffix is set as the Organization Domain
const orgs = await getOrgsByDomain({ serviceConfig, domain: suffix });
const orgToCheckForDiscovery = orgs.result && orgs.result.length === 1 ? orgs.result[0].id : undefined;
+1 -2
View File
@@ -8,6 +8,5 @@ export async function getDeviceAuthorizationRequest(userCode: string) {
const _headers = await headers();
const { serviceConfig } = getServiceConfig(_headers);
return zitadelGetDeviceAuthorizationRequest({ serviceConfig, userCode,
});
return zitadelGetDeviceAuthorizationRequest({ serviceConfig, userCode });
}
+1 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, test, vi, beforeEach } from "vitest";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { sendPasskey } from "./passkeys";
// Mock all the dependencies
+3 -3
View File
@@ -17,16 +17,16 @@ import {
RegisterPasskeyResponse,
VerifyPasskeyRegistrationRequestSchema,
} from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { getTranslations } from "next-intl/server";
import { headers } from "next/headers";
import { userAgent } from "next/server";
import { getTranslations } from "next-intl/server";
import { completeFlowOrGetUrl } from "../client";
import { getSessionCookieById } from "../cookies";
import { getServiceConfig } from "../service-url";
import { checkEmailVerification, checkUserVerification } from "../verify-helper";
import { createSessionAndUpdateCookie } from "./cookie";
import { getPublicHost } from "./host";
import { updateOrCreateSession } from "./session";
import { completeFlowOrGetUrl } from "../client";
import { createSessionAndUpdateCookie } from "./cookie";
const logger = createLogger("passkeys");
@@ -113,7 +113,10 @@ describe("sendPassword", () => {
});
// 3. Login settings
mockGetLoginSettings.mockResolvedValue({ passwordCheckLifetime: { seconds: BigInt(86400) }, allowLocalAuthentication: true });
mockGetLoginSettings.mockResolvedValue({
passwordCheckLifetime: { seconds: BigInt(86400) },
allowLocalAuthentication: true,
});
// 4. Create session success
mockCreateSessionAndUpdateCookie.mockResolvedValue({
+1 -1
View File
@@ -1,7 +1,7 @@
"use server";
import { createLogger } from "@/lib/logger";
import { recordAuthAttempt, recordAuthSuccess, recordAuthFailure } from "@/lib/metrics";
import { recordAuthAttempt, recordAuthFailure, recordAuthSuccess } from "@/lib/metrics";
import { createSessionAndUpdateCookie, setSessionAndUpdateCookie } from "@/lib/server/cookie";
import {
getLockoutSettings,
+4 -4
View File
@@ -5,13 +5,13 @@ import { addHumanUser, addIDPLink, getLoginSettings, getUserByID, listAuthentica
import { create } from "@zitadel/client";
import { Factors } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { ChecksJson, ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
import { cookies, headers } from "next/headers";
import crypto from "crypto";
import { getTranslations } from "next-intl/server";
import { cookies, headers } from "next/headers";
import { completeFlowOrGetUrl } from "../client";
import { getOrSetFingerprintId } from "../fingerprint";
import { getServiceConfig } from "../service-url";
import { checkEmailVerification, checkMFAFactors } from "../verify-helper";
import { getOrSetFingerprintId } from "../fingerprint";
import crypto from "crypto";
import { completeFlowOrGetUrl } from "../client";
type RegisterUserCommand = {
email: string;
+3 -3
View File
@@ -1,10 +1,10 @@
import { vi, describe, expect, test, beforeEach } from "vitest";
import { beforeEach, describe, expect, test, vi } from "vitest";
import { sendVerification } from "./verify";
import { verifyEmail, getUserByID, getSession, listAuthenticationMethodTypes } from "@/lib/zitadel";
import { getSession, getUserByID, listAuthenticationMethodTypes, verifyEmail } from "@/lib/zitadel";
import { cookies } from "next/headers";
import { getSessionCookieByLoginName } from "../cookies";
import { createSessionAndUpdateCookie } from "./cookie";
import { cookies } from "next/headers";
// Mock dependencies
vi.mock("@/lib/zitadel", () => ({
+1 -1
View File
@@ -18,6 +18,7 @@ import { create } from "@zitadel/client";
import { Session } from "@zitadel/proto/zitadel/session/v2/session_pb";
import { ChecksSchema } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { getTranslations } from "next-intl/server";
import { cookies, headers } from "next/headers";
import { completeFlowOrGetUrl } from "../client";
import { getSessionCookieByLoginName } from "../cookies";
@@ -27,7 +28,6 @@ import { loadMostRecentSession } from "../session";
import { checkMFAFactors } from "../verify-helper";
import { createSessionAndUpdateCookie } from "./cookie";
import { getPublicHostWithProtocol } from "./host";
import { getTranslations } from "next-intl/server";
const logger = createLogger("verify");
+2 -2
View File
@@ -1,6 +1,6 @@
import { describe, expect, test, beforeEach, afterEach, vi } from "vitest";
import { getServiceConfig, constructUrl } from "./service-url";
import { NextRequest } from "next/server";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { constructUrl, getServiceConfig } from "./service-url";
describe("Service URL utilities", () => {
const originalEnv = process.env;
+1 -1
View File
@@ -1,7 +1,7 @@
import { ReadonlyHeaders } from "next/dist/server/web/spec-extension/adapters/headers";
import { NextRequest } from "next/server";
import { ServiceConfig } from "./zitadel";
import { getInstanceHost, getPublicHost } from "./server/host";
import { ServiceConfig } from "./zitadel";
/**
* Extracts the service URL based on deployment mode and configuration.
+2 -2
View File
@@ -6,8 +6,8 @@ import { SAMLService } from "@zitadel/proto/zitadel/saml/v2/saml_service_pb";
import { SessionService } from "@zitadel/proto/zitadel/session/v2/session_service_pb";
import { SettingsService } from "@zitadel/proto/zitadel/settings/v2/settings_service_pb";
import { UserService } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import { systemAPIToken, loginServiceKeyToken } from "./api";
import { hasSystemUserCredentials, hasLoginServiceKey, hasServiceUserToken } from "./deployment";
import { loginServiceKeyToken, systemAPIToken } from "./api";
import { hasLoginServiceKey, hasServiceUserToken, hasSystemUserCredentials } from "./deployment";
import { createServerTransport, ServiceConfig } from "./zitadel";
type ServiceClass =
+1 -1
View File
@@ -1,6 +1,6 @@
"use client";
import { useState, useEffect } from "react";
import { useEffect, useState } from "react";
import { getThemeConfig } from "./theme";
/**
+7 -7
View File
@@ -1,17 +1,17 @@
import { describe, it, expect, beforeEach, afterEach } from "vitest";
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import {
ThemeRoundness,
ThemeLayout,
ThemeAppearance,
ThemeSpacing,
APPEARANCE_STYLES,
ComponentRoundnessConfig,
DEFAULT_COMPONENT_ROUNDNESS,
DEFAULT_THEME,
getComponentRoundness,
getThemeConfig,
ROUNDNESS_CLASSES,
getComponentRoundness,
SPACING_STYLES,
APPEARANCE_STYLES,
ThemeAppearance,
ThemeLayout,
ThemeRoundness,
ThemeSpacing,
} from "./theme";
describe("Theme Configuration", () => {
+7 -7
View File
@@ -1,17 +1,17 @@
import { describe, it, expect, beforeEach, vi, afterEach } from "vitest";
import { shouldEnforceMFA } from "./verify-helper";
import { cookies } from "next/headers";
import { getFingerprintIdCookie } from "./fingerprint";
import crypto from "crypto";
import { cookies } from "next/headers";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { getFingerprintIdCookie } from "./fingerprint";
import { shouldEnforceMFA } from "./verify-helper";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
import {
checkPasswordChangeRequired,
checkEmailVerified,
checkEmailVerification,
checkEmailVerified,
checkMFAFactors,
checkPasswordChangeRequired,
checkUserVerification,
} from "./verify-helper";
import { AuthenticationMethodType } from "@zitadel/proto/zitadel/user/v2/user_service_pb";
// Mock function to create timestamps - following the same pattern as session.test.ts
function createMockTimestamp(offsetMs = 3600000): any {
+2 -2
View File
@@ -1,8 +1,6 @@
import { Client, create, Duration } from "@zitadel/client";
import { createServerTransport as libCreateServerTransport } from "@zitadel/client/node";
import { makeReqCtx } from "@zitadel/client/v2";
import { otelGrpcInterceptor } from "./grpc/interceptors/otel";
import { createLogger } from "./logger";
import { IdentityProviderService } from "@zitadel/proto/zitadel/idp/v2/idp_service_pb";
import { OrganizationSchema, TextQueryMethod } from "@zitadel/proto/zitadel/object/v2/object_pb";
import { CreateCallbackRequest, OIDCService } from "@zitadel/proto/zitadel/oidc/v2/oidc_service_pb";
@@ -34,6 +32,8 @@ import {
import { getTranslations } from "next-intl/server";
import { unstable_cacheLife as cacheLife } from "next/cache";
import { getUserAgent } from "./fingerprint";
import { otelGrpcInterceptor } from "./grpc/interceptors/otel";
import { createLogger } from "./logger";
import { createServiceForHost } from "./service";