propro-utils 1.3.31 → 1.3.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +3 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "propro-utils",
3
- "version": "1.3.31",
3
+ "version": "1.3.32",
4
4
  "description": "Auth middleware for propro-auth",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
package/src/index.js CHANGED
@@ -24,6 +24,7 @@ let _serverAuth, _clientAuth;
24
24
  * }
25
25
  * @param {boolean} [options.useClientAuth=false] - A boolean flag to enable client-side authentication.
26
26
  * @param {Object} [options.clientOptions={}] - Configuration options for client-side authentication.
27
+ * @param {Schema} [userSchema] - The user schema to perform the operations on.
27
28
  *
28
29
  * @returns {Function} An Express middleware function.
29
30
  *
@@ -40,7 +41,7 @@ let _serverAuth, _clientAuth;
40
41
  * useClientAuth: false,
41
42
  * }));
42
43
  */
43
- module.exports = function proproAuthMiddleware(options = {}) {
44
+ module.exports = function proproAuthMiddleware(options = {}, userSchema) {
44
45
  validateEnvironmentVariables([
45
46
  "AUTH_URL",
46
47
  "CLIENT_ID",
@@ -52,7 +53,7 @@ module.exports = function proproAuthMiddleware(options = {}) {
52
53
  try {
53
54
  // Lazy loading and initializing server and client authentication modules with options
54
55
  if (options.useServerAuth) {
55
- _serverAuth = _serverAuth || require("./server")(options.serverOptions);
56
+ _serverAuth = _serverAuth || require("./server")(options.serverOptions, userSchema);
56
57
  _serverAuth(req, res, next);
57
58
  } else if (options.useClientAuth) {
58
59
  _clientAuth = _clientAuth || require("./client")(options.clientOptions);