chore(login): migrate nextjs login to monorepo (#10134)

# Which Problems Are Solved

We move the login code to the zitadel repo.

# How the Problems Are Solved

The login repo is added to ./login as a git subtree pulled from the
dockerize-ci branch.
Apart from the login code, this PR contains the changes from #10116

# Additional Context

- Closes https://github.com/zitadel/typescript/issues/474
- Also merges #10116  
- Merging is blocked by failing check because of:
- https://github.com/zitadel/zitadel/pull/10134#issuecomment-3012086106

---------

Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Max Peintner <[email protected]>
Co-authored-by: Florian Forster <[email protected]>
This commit is contained in:
Elio Bischof
2025-07-02 10:04:19 +02:00
committed by GitHub
co-authored by Max Peintner Max Peintner Florian Forster
parent fce9e770ac
commit 2928c6ac2b
416 changed files with 38969 additions and 10 deletions
+36
View File
@@ -0,0 +1,36 @@
import { createGrpcTransport, GrpcTransportOptions } from "@connectrpc/connect-node";
import { importPKCS8, SignJWT } from "jose";
import { NewAuthorizationBearerInterceptor } from "./interceptors.js";
/**
* Create a server transport using grpc with the given token and configuration options.
* @param token
* @param opts
*/
export function createServerTransport(token: string, opts: GrpcTransportOptions) {
return createGrpcTransport({
...opts,
interceptors: [...(opts.interceptors || []), NewAuthorizationBearerInterceptor(token)],
});
}
export async function newSystemToken({
audience,
subject,
key,
expirationTime,
}: {
audience: string;
subject: string;
key: string;
expirationTime?: number | string | Date;
}) {
return await new SignJWT({})
.setProtectedHeader({ alg: "RS256" })
.setIssuedAt()
.setExpirationTime(expirationTime ?? "1h")
.setIssuer(subject)
.setSubject(subject)
.setAudience(audience)
.sign(await importPKCS8(key, "RS256"));
}