@opengis/fastify-table 2.1.15 → 2.1.16
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/jwt/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAyBvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../../server/routes/auth/controllers/jwt/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAyBvC,wBAA8B,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,YAAY,kBAkHpE"}
|
|
@@ -51,7 +51,9 @@ export default async function authorize(req, reply) {
|
|
|
51
51
|
if (!user) {
|
|
52
52
|
return reply.code(404).send({ error: "user not found", code: 404 });
|
|
53
53
|
}
|
|
54
|
-
const href1 =
|
|
54
|
+
const href1 = req.method === "POST"
|
|
55
|
+
? null
|
|
56
|
+
: await authorizeUser(user, req, "jwt", expireMsec);
|
|
55
57
|
const ip = getIp(req);
|
|
56
58
|
// Generate authorization code
|
|
57
59
|
const code = sign(userId, secret, expireMsec, ip);
|
|
@@ -85,10 +87,14 @@ export default async function authorize(req, reply) {
|
|
|
85
87
|
const href = redirect_uri && !redirect_uri.includes("?")
|
|
86
88
|
? backUrl
|
|
87
89
|
: backUrl?.replace?.(/\?code=/, "&code=") || href1;
|
|
88
|
-
if (req.method === "POST"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
if (req.method === "POST") {
|
|
91
|
+
return reply.status(200).send({
|
|
92
|
+
code,
|
|
93
|
+
redirect_uri: href,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (payload.noredirect || process.env.NODE_ENV === "test") {
|
|
97
|
+
return reply.status(200).send(code);
|
|
92
98
|
}
|
|
93
99
|
return reply.redirect(href);
|
|
94
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkD1C,iBAAS,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,GAAE,GAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/routes/auth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkD1C,iBAAS,MAAM,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,GAAE,GAAQ,QAwFlD;AAED,eAAe,MAAM,CAAC"}
|
|
@@ -77,6 +77,9 @@ function plugin(app, opt = {}) {
|
|
|
77
77
|
if (!app.hasRoute({ method: "GET", url: "/oauth/authorize" })) {
|
|
78
78
|
app.get("/oauth/authorize", params, oauthAuthorize);
|
|
79
79
|
}
|
|
80
|
+
if (!app.hasRoute({ method: "POST", url: "/oauth/authorize" })) {
|
|
81
|
+
app.post("/oauth/authorize", params, oauthAuthorize);
|
|
82
|
+
}
|
|
80
83
|
if (!app.hasRoute({ method: "GET", url: "/oauth/token" })) {
|
|
81
84
|
app.get("/oauth/token", params, oauthToken);
|
|
82
85
|
}
|