idp build fix

This commit is contained in:
peintnermax
2023-08-23 08:24:12 +02:00
parent fb1cbb0ab9
commit 8056c81161
3 changed files with 30 additions and 26 deletions

View File

@@ -1,10 +1,10 @@
import { ProviderSlug } from "#/lib/demos";
import { addHumanUser, server } from "#/lib/zitadel";
import { server } from "#/lib/zitadel";
import Alert, { AlertType } from "#/ui/Alert";
import {
AddHumanUserRequest,
IDPInformation,
RetrieveIdentityProviderInformationResponse,
RetrieveIdentityProviderIntentResponse,
user,
IDPLink,
} from "@zitadel/server";
@@ -27,8 +27,8 @@ const PROVIDER_MAPPING: {
// organisation: Organisation | undefined;
profile: {
displayName: idp.rawInformation?.User?.name ?? "",
firstName: idp.rawInformation?.User?.given_name ?? "",
lastName: idp.rawInformation?.User?.family_name ?? "",
givenName: idp.rawInformation?.User?.given_name ?? "",
familyName: idp.rawInformation?.User?.family_name ?? "",
},
idpLinks: [idpLink],
};
@@ -49,8 +49,8 @@ const PROVIDER_MAPPING: {
// organisation: Organisation | undefined;
profile: {
displayName: idp.rawInformation?.name ?? "",
firstName: idp.rawInformation?.name ?? "",
lastName: idp.rawInformation?.name ?? "",
givenName: idp.rawInformation?.name ?? "",
familyName: idp.rawInformation?.name ?? "",
},
idpLinks: [idpLink],
};
@@ -64,8 +64,11 @@ function retrieveIDP(
): Promise<IDPInformation | undefined> {
const userService = user.getUser(server);
return userService
.retrieveIdentityProviderInformation({ intentId: id, token: token }, {})
.then((resp: RetrieveIdentityProviderInformationResponse) => {
.retrieveIdentityProviderIntent(
{ idpIntentId: id, idpIntentToken: token },
{}
)
.then((resp: RetrieveIdentityProviderIntentResponse) => {
return resp.idpInformation;
});
}

View File

@@ -26,15 +26,16 @@ import {
LoginSettings,
GetLoginSettingsResponse,
ListAuthenticationMethodTypesResponse,
StartIdentityProviderFlowRequest,
StartIdentityProviderFlowResponse,
RetrieveIdentityProviderInformationRequest,
RetrieveIdentityProviderInformationResponse,
StartIdentityProviderIntentRequest,
StartIdentityProviderIntentResponse,
RetrieveIdentityProviderIntentRequest,
RetrieveIdentityProviderIntentResponse,
GetAuthRequestResponse,
GetAuthRequestRequest,
CreateCallbackRequest,
CreateCallbackResponse,
RequestChallenges,
AddHumanUserRequest,
} from "@zitadel/server";
export const zitadelConfig: ZitadelServerOptions = {
@@ -190,10 +191,10 @@ export async function addHumanUser(
): Promise<string> {
const userService = user.getUser(server);
const payload = {
const payload: Partial<AddHumanUserRequest> = {
email: { email },
username: email,
profile: { firstName, lastName },
profile: { givenName: firstName, familyName: lastName },
};
return userService
.addHumanUser(
@@ -212,11 +213,11 @@ export async function addHumanUser(
export async function startIdentityProviderFlow(
server: ZitadelServer,
{ idpId, urls }: StartIdentityProviderFlowRequest
): Promise<StartIdentityProviderFlowResponse> {
{ idpId, urls }: StartIdentityProviderIntentRequest
): Promise<StartIdentityProviderIntentResponse> {
const userService = user.getUser(server);
return userService.startIdentityProviderFlow({
return userService.startIdentityProviderIntent({
idpId,
urls,
});
@@ -224,13 +225,13 @@ export async function startIdentityProviderFlow(
export async function retrieveIdentityProviderInformation(
server: ZitadelServer,
{ intentId, token }: RetrieveIdentityProviderInformationRequest
): Promise<RetrieveIdentityProviderInformationResponse> {
{ idpIntentId, idpIntentToken }: RetrieveIdentityProviderIntentRequest
): Promise<RetrieveIdentityProviderIntentResponse> {
const userService = user.getUser(server);
return userService.retrieveIdentityProviderInformation({
intentId,
token,
return userService.retrieveIdentityProviderIntent({
idpIntentId,
idpIntentToken,
});
}

View File

@@ -71,10 +71,10 @@ export {
ListAuthenticationMethodTypesResponse,
ListAuthenticationMethodTypesRequest,
AuthenticationMethodType,
StartIdentityProviderFlowRequest,
StartIdentityProviderFlowResponse,
RetrieveIdentityProviderInformationRequest,
RetrieveIdentityProviderInformationResponse,
StartIdentityProviderIntentRequest,
StartIdentityProviderIntentResponse,
RetrieveIdentityProviderIntentRequest,
RetrieveIdentityProviderIntentResponse,
} from "./proto/server/zitadel/user/v2alpha/user_service";
export {
SetHumanPasswordResponse,