constructor()

in src/auth/auth-config.ts [1141:1181]


  constructor(response: SAMLConfigServerResponse) {
    if (!response ||
        !response.idpConfig ||
        !response.idpConfig.idpEntityId ||
        !response.idpConfig.ssoUrl ||
        !response.spConfig ||
        !response.spConfig.spEntityId ||
        !response.name ||
        !(validator.isString(response.name) &&
          SAMLConfig.getProviderIdFromResourceName(response.name))) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INTERNAL_ERROR,
        'INTERNAL ASSERT FAILED: Invalid SAML configuration response');
    }

    const providerId = SAMLConfig.getProviderIdFromResourceName(response.name);
    if (!providerId) {
      throw new FirebaseAuthError(
        AuthClientErrorCode.INTERNAL_ERROR,
        'INTERNAL ASSERT FAILED: Invalid SAML configuration response');
    }
    this.providerId = providerId;

    // RP config.
    this.rpEntityId = response.spConfig.spEntityId;
    this.callbackURL = response.spConfig.callbackUri;
    // IdP config.
    this.idpEntityId = response.idpConfig.idpEntityId;
    this.ssoURL = response.idpConfig.ssoUrl;
    this.enableRequestSigning = !!response.idpConfig.signRequest;
    const x509Certificates: string[] = [];
    for (const cert of (response.idpConfig.idpCertificates || [])) {
      if (cert.x509Certificate) {
        x509Certificates.push(cert.x509Certificate);
      }
    }
    this.x509Certificates = x509Certificates;
    // When enabled is undefined, it takes its default value of false.
    this.enabled = !!response.enabled;
    this.displayName = response.displayName;
  }