This commit is contained in:
peintnermax
2024-08-09 10:57:39 +02:00
parent a5841149f4
commit 5a201e312a
3 changed files with 9 additions and 11 deletions

View File

@@ -46,13 +46,11 @@ const PROVIDER_MAPPING: {
},
[ProviderSlug.AZURE]: (idp: IDPInformation) => {
const rawInfo = idp.rawInformation?.toJson() as {
User: {
mail: string;
displayName?: string;
givenName?: string;
surname?: string;
};
};
const idpLink: PartialMessage<IDPLink> = {
idpId: idp.idpId,
@@ -63,14 +61,14 @@ const PROVIDER_MAPPING: {
const req: PartialMessage<AddHumanUserRequest> = {
username: idp.userName,
email: {
email: rawInfo.User?.mail,
email: rawInfo?.mail,
verification: { case: "isVerified", value: true },
},
// organisation: Organisation | undefined;
profile: {
displayName: rawInfo.User?.displayName ?? "",
givenName: rawInfo.User?.givenName ?? "",
familyName: rawInfo.User?.surname ?? "",
displayName: rawInfo?.displayName ?? "",
givenName: rawInfo?.givenName ?? "",
familyName: rawInfo?.surname ?? "",
},
idpLinks: [idpLink],
};

View File

@@ -4,7 +4,6 @@ import {
getLoginSettings,
listAuthenticationMethodTypes,
listUsers,
PROVIDER_NAME_MAPPING,
startIdentityProviderFlow,
} from "@/lib/zitadel";
import { createSessionForUserIdAndUpdateCookie } from "@/utils/session";

View File

@@ -298,6 +298,7 @@ export const PROVIDER_NAME_MAPPING: {
} = {
[ProviderSlug.GOOGLE]: "Google",
[ProviderSlug.GITHUB]: "GitHub",
[ProviderSlug.AZURE]: "Microft",
};
export async function startIdentityProviderFlow({