0
Fork 0
mirror of https://github.com/logto-io/logto.git synced 2025-02-03 21:48:55 -05:00

fix: fix SAML app console issues (#6969)

This commit is contained in:
Darcy Ye 2025-01-22 17:31:30 +08:00 committed by GitHub
parent e2d6302d58
commit 2633723861
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 18 additions and 13 deletions

View file

@ -21,7 +21,7 @@ export const parseSamlApplicationResponseToFormData = (
nameIdFormat, nameIdFormat,
encryptSamlAssertion: encryption?.encryptAssertion ?? false, encryptSamlAssertion: encryption?.encryptAssertion ?? false,
encryptThenSignSamlAssertion: encryption?.encryptThenSign ?? false, encryptThenSignSamlAssertion: encryption?.encryptThenSign ?? false,
certificate: encryption?.certificate, certificate: encryption?.certificate ?? '',
}; };
}; };
@ -55,14 +55,19 @@ export const parseFormDataToSamlApplicationRequest = (
acsUrl: acsUrlData, acsUrl: acsUrlData,
nameIdFormat, nameIdFormat,
...cond( ...cond(
encryptSamlAssertion && encryptSamlAssertion
? cond(
certificate && { certificate && {
certificate: { encryption: {
encryptAssertion: encryptSamlAssertion, encryptAssertion: encryptSamlAssertion,
certificate, certificate,
encryptThenSign: encryptThenSignSamlAssertion, encryptThenSign: encryptThenSignSamlAssertion,
}, },
} }
)
: {
encryption: null,
}
), ),
}), }),
}; };

View file

@ -51,14 +51,14 @@ export const samlEncryptionGuard = z
export type SamlEncryption = z.input<typeof samlEncryptionGuard>; export type SamlEncryption = z.input<typeof samlEncryptionGuard>;
export enum NameIdFormat { export enum NameIdFormat {
/** The Identity Provider can determine the format. */
Unspecified = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
/** Returns the email address of the user. */
EmailAddress = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
/** Uses unique and persistent identifiers for the user. */ /** Uses unique and persistent identifiers for the user. */
Persistent = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent', Persistent = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
/** Returns the email address of the user. */
EmailAddress = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress',
/** Uses unique and transient identifiers for the user, which can be different for each session. */ /** Uses unique and transient identifiers for the user, which can be different for each session. */
Transient = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient', Transient = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient',
/** The Identity Provider can determine the format. */
Unspecified = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified',
} }
export const nameIdFormatGuard = z.nativeEnum(NameIdFormat); export const nameIdFormatGuard = z.nativeEnum(NameIdFormat);