"use strict";
exports.id = 4988;
exports.ids = [4988];
exports.modules = {

/***/ 26438:
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */   "Z": () => (/* binding */ getParams)
/* harmony export */ });
function getParams(req) {
    if (req?.method == "POST") {
        return new Proxy({}, {
            get (_, key) {
                return req.body?.[key];
            }
        });
    /*
    // Disabled, since this could lead to a sneaky click on a link attack.
    // Should only be enabled for dev purposes.
    } else if (req?.method == "GET") {
    return new Proxy(
      {},
      {
        get(_, key) {
          if (typeof key != "string") {
            return undefined;
          }
          return req.query?.[key];
        },
      }
    );
*/ } else {
        // only support params for POST requests.
        return {};
    }
}


/***/ }),

/***/ 234894:
/***/ ((__unused_webpack_module, exports) => {


/*
 *  This file is part of CoCalc: Copyright © 2022 Sagemath, Inc.
 *  License: AGPLv3 s.t. "Commons Clause" – see LICENSE.md for details
 */
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.emailBelongsToDomain = exports.getEmailDomain = exports.checkRequiredSSO = void 0;
function checkRequiredSSO(opts) {
    const { email, strategies, specificStrategy } = opts;
    // if the domain of email is contained in any of the strategie's exclusiveDomain array, return that strategy's name
    if (email == null)
        return;
    if (strategies == null || strategies.length === 0)
        return;
    if (email.indexOf("@") === -1)
        return;
    const emailDomain = getEmailDomain(email);
    if (!emailDomain)
        return;
    for (const strategy of strategies) {
        if (specificStrategy && specificStrategy !== strategy.name)
            continue;
        for (const ssoDomain of strategy.exclusiveDomains) {
            if (emailBelongsToDomain(emailDomain, ssoDomain)) {
                return strategy;
            }
        }
    }
}
exports.checkRequiredSSO = checkRequiredSSO;
function getEmailDomain(email) {
    return email.trim().toLowerCase().split("@")[1];
}
exports.getEmailDomain = getEmailDomain;
function emailBelongsToDomain(emailDomain, ssoDomain) {
    return emailDomain === ssoDomain || emailDomain.endsWith(`.${ssoDomain}`);
}
exports.emailBelongsToDomain = emailBelongsToDomain;
//# sourceMappingURL=check-required-sso.js.map

/***/ })

};
;