mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-08 23:25:12 +00:00
Merge commit from fork
* fix: Improve host header handling and deployment mode detection * ZITADEL_CLOUD env * refactor service config * service config * cleanup * cleanup * util for original and public host * instanceHost, publicHost * cleanup constructUrl * cleanup middleware * add x-zitadel-forward-host as fallback for current cloud setup * fix build * fix: lint * fix: update test mocks * fix: provide basepath to unit tests * host handling * unit tests * imports * fix: getPublicHost instead of getInstanceHost * unit tests * update nextjs, implement jwt verify for logout_token * pass logout information in jwt to login v2 * handle hosts in jwks url * point idp callbacks to the api and not the login UI * logout_hint out of logout token, typecheck * rm unused imports * fix oidc integration test --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
f9e3871bb3
commit
df75be96ff
@@ -3,14 +3,11 @@
|
||||
import { createUserServiceClient } from "@zitadel/client/v2";
|
||||
import { headers } from "next/headers";
|
||||
import { getSessionCookieById } from "./cookies";
|
||||
import { getServiceUrlFromHeaders } from "./service-url";
|
||||
import { createServerTransport, getSession } from "./zitadel";
|
||||
import { getServiceConfig } from "./service-url";
|
||||
import { createServerTransport, getSession, ServiceConfig } from "./zitadel";
|
||||
|
||||
const myUserService = async (serviceUrl: string, sessionToken: string) => {
|
||||
const transportPromise = await createServerTransport(
|
||||
sessionToken,
|
||||
serviceUrl,
|
||||
);
|
||||
const myUserService = async (serviceConfig: ServiceConfig, sessionToken: string) => {
|
||||
const transportPromise = await createServerTransport(sessionToken, serviceConfig);
|
||||
return createUserServiceClient(transportPromise);
|
||||
};
|
||||
|
||||
@@ -22,13 +19,11 @@ export async function setMyPassword({
|
||||
password: string;
|
||||
}) {
|
||||
const _headers = await headers();
|
||||
const { serviceUrl } = getServiceUrlFromHeaders(_headers);
|
||||
const { serviceConfig } = getServiceConfig(_headers);
|
||||
|
||||
const sessionCookie = await getSessionCookieById({ sessionId });
|
||||
|
||||
const { session } = await getSession({
|
||||
serviceUrl,
|
||||
sessionId: sessionCookie.id,
|
||||
const { session } = await getSession({ serviceConfig, sessionId: sessionCookie.id,
|
||||
sessionToken: sessionCookie.token,
|
||||
});
|
||||
|
||||
@@ -36,7 +31,7 @@ export async function setMyPassword({
|
||||
return { error: "Could not load session" };
|
||||
}
|
||||
|
||||
const service = await myUserService(serviceUrl, `${sessionCookie.token}`);
|
||||
const service = await myUserService(serviceConfig, `${sessionCookie.token}`);
|
||||
|
||||
if (!session?.factors?.user?.id) {
|
||||
return { error: "No user id found in session" };
|
||||
|
||||
Reference in New Issue
Block a user