/**
* Handler that will be called during the execution of a PostLogin flow.
*
* @param {Event} event - Details about the user and the context in which they are logging in.
* @param {PostLoginAPI} api - Interface whose methods can be used to change the behavior of the login.
*/
exports.onExecutePostLogin = async (event, api) => {
// replace with the ID of the application that has the SAML Web App Addon enabled
// for which you want to change the signing key pair.
const samlIdpClientId = 'YOUR_SAML_APP_CLIENT_ID';
// only do this for the specific client ID. If you have multiple IdPs that require
// custom certificates, you will have an "if" statement for each one.
if (event.client.client_id === samlIdpClientId) {
// ここに独自の秘密鍵と証明書を指定します
// フォーマット手順については https://auth0.com/docs/authenticate/protocols/saml/saml-sso-integrations/work-with-certificates-and-keys-as-strings を参照してください
// 基本的にはPEM形式の証明書から始めて、
// 改行を"\n"に置き換えます
const signingCert = "-----BEGIN CERTIFICATE-----\nnMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV[..all the other lines..]-----END CERTIFICATE-----\n";
const signingKey = "-----BEGIN PRIVATE KEY-----\nnMIIC8jCCAdqgAwIBAgIJObB6jmhG0QIEMA0GCSqGSIb3DQEBBQUAMCAxHjAcBgNV[..all the other lines..]-----END PRIVATE KEY-----\n";
api.samlResponse.setCert(signingCert)
api.samlResponse.setKey(signingKey);
}
};