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

View File

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

View File

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