Files
zitadel/apps/login/app/(login)/idp/page.tsx

51 lines
1.4 KiB
TypeScript
Raw Normal View History

2023-07-17 17:14:02 +02:00
import { getLegalAndSupportSettings, server } from "#/lib/zitadel";
2023-07-27 11:05:42 +02:00
import { SignInWithIDP } from "#/ui/SignInWithIDP";
import {
GetActiveIdentityProvidersResponse,
IdentityProvider,
ZitadelServer,
settings,
} from "@zitadel/server";
function getIdentityProviders(
server: ZitadelServer,
orgId?: string
): Promise<IdentityProvider[] | undefined> {
const settingsService = settings.getSettings(server);
return settingsService
.getActiveIdentityProviders(
orgId ? { ctx: { orgId } } : { ctx: { instance: true } },
{}
)
.then((resp: GetActiveIdentityProvidersResponse) => {
return resp.identityProviders;
});
}
2023-07-17 17:14:02 +02:00
2023-08-02 13:25:16 +02:00
export default async function Page() {
2023-07-17 17:14:02 +02:00
const legal = await getLegalAndSupportSettings(server);
2023-08-02 13:25:16 +02:00
// TODO if org idps should be shown replace emptystring with the orgId.
const identityProviders = await getIdentityProviders(server, "");
2023-08-02 10:23:55 +02:00
const host = process.env.VERCEL_URL
? `https://${process.env.VERCEL_URL}`
: "http://localhost:3000";
2023-07-17 17:14:02 +02:00
return (
<div className="flex flex-col items-center space-y-4">
<h1>Register</h1>
2023-07-31 11:56:23 +02:00
<p className="ztdl-p">
Select one of the following providers to register
</p>
2023-07-17 17:14:02 +02:00
2023-07-31 11:56:23 +02:00
{legal && identityProviders && process.env.ZITADEL_API_URL && (
<SignInWithIDP
2023-08-02 10:23:55 +02:00
host={host}
2023-07-31 11:56:23 +02:00
identityProviders={identityProviders}
></SignInWithIDP>
)}
2023-07-17 17:14:02 +02:00
</div>
);
}