@opengis/fastify-table 2.5.70 → 2.5.71

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.
@@ -26,7 +26,9 @@ export default async function authorize(req, reply) {
26
26
  }
27
27
  const ip = getIp(req);
28
28
  const q = `select * from oauth.clients where client_id=$1 and token_endpoint_auth_method=$2 and (allowed_ips is null or $3=any(allowed_ips)) and ${scope ? "$4=any(scopes)" : "1=1"} order by allowed_ips nulls last limit 1`;
29
- const { owner_user_id: userId, client_secret_hash: secret, redirect_uris = [], scopes, allowed_ips: allowedIPs = [], } = pg.pk?.["oauth.clients"]
29
+ const { owner_user_id: userId, client_secret_hash: secret, redirect_uris = [], scopes,
30
+ // allowed_ips: allowedIPs = [],
31
+ } = pg.pk?.["oauth.clients"]
30
32
  ? await pg
31
33
  .query(q, [client_id, "private_key_jwt", ip, scope].filter(Boolean))
32
34
  .then((el) => el.rows?.[0] || {})
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AAgDA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAuGtC;AAED,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AA6DA,iBAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,GAAE,GAAQ,QAsGtC;AAED,eAAe,MAAM,CAAC"}
@@ -23,6 +23,19 @@ import qrCode from "./controllers/2factor/qrcode.js";
23
23
  const tags = ["core", "auth"];
24
24
  const packageName = "fastify-table";
25
25
  const params = { config: { policy: "L0", tags, package: packageName } };
26
+ const loginApiParams = {
27
+ config: {
28
+ policy: "L0",
29
+ tags,
30
+ package: packageName,
31
+ rateLimit: config.rateLimit
32
+ ? {
33
+ max: +(config.rateLimit?.login?.max || 5),
34
+ timeWindow: config.rateLimit?.login?.timeWindow || "1 minute",
35
+ }
36
+ : undefined,
37
+ },
38
+ };
26
39
  const registrationSchema = {
27
40
  body: {
28
41
  type: "object",
@@ -44,13 +57,11 @@ function plugin(app, opt = {}) {
44
57
  app.get("/logout", params, logout);
45
58
  }
46
59
  if (!app.hasRoute({ method: "GET", url: "/api/login" }) &&
47
- process.env.DISABLE_GET_LOGIN !== "true"
48
- // && process.env.platform === "win32"
49
- ) {
50
- app.get("/api/login", params, login);
60
+ process.env.DISABLE_GET_LOGIN !== "true") {
61
+ app.get("/api/login", loginApiParams, login);
51
62
  }
52
63
  if (!app.hasRoute({ method: "POST", url: "/api/login" })) {
53
- app.post("/api/login", params, login);
64
+ app.post("/api/login", loginApiParams, login);
54
65
  }
55
66
  if (!app.hasRoute({ method: "POST", url: "/api/registration" })) {
56
67
  app.post("/api/registration", { ...params, schema: registrationSchema }, registration);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.5.70",
3
+ "version": "2.5.71",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [