@nodefony/framework 10.0.0-alpha.2 → 10.0.0-alpha.3

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.
@@ -44,7 +44,13 @@ var OAuth2Controller = class extends Controller {
44
44
  const flow = this.#flow();
45
45
  if (!svc || !flow) return this.renderJson({ error: "OAuth unavailable" }, 503);
46
46
  if (!svc.listProviders().includes(provider)) return this.renderJson({ error: "Unknown provider" }, 404);
47
- const auth = await svc.createAuthorization(provider);
47
+ let auth;
48
+ try {
49
+ auth = await svc.createAuthorization(provider);
50
+ } catch (error) {
51
+ this.log(`oauth2 authorize "${provider}" : ${error.message}`, "ERROR");
52
+ return this.renderJson({ error: "OAuth provider unavailable" }, 503);
53
+ }
48
54
  const session = await flow.ensureSession(this.context);
49
55
  if (!session) return this.renderJson({ error: "Session unavailable" }, 503);
50
56
  session.set(STATE_KEY, auth.state);
@@ -75,7 +81,8 @@ var OAuth2Controller = class extends Controller {
75
81
  const { identifier } = await svc.exchangeAndProvision(provider, code, typeof storedVerifier === "string" ? storedVerifier : null, returnedIss);
76
82
  await flow.establishSessionFor(this.context, identifier, "oauth");
77
83
  return this.redirect(success, 302);
78
- } catch {
84
+ } catch (error) {
85
+ this.log(`oauth2 callback "${provider}" : ${error.message.slice(0, 200)}`, "WARNING");
79
86
  return this.redirect(failure, 302);
80
87
  }
81
88
  }
@@ -3,7 +3,7 @@ import type { ContextType } from "@nodefony/http";
3
3
  import Controller from "../src/Controller.js";
4
4
  /**
5
5
  * Vue MINIMALE du service `oauth2` (`@nodefony/security`) — couplage par NOM
6
- * (framework ne dépend ni de security ni d'arctic). Contrat structurel imposé par
6
+ * (framework ne dépend pas de security). Contrat structurel imposé par
7
7
  * cast (`this.get<…>`), aucune liaison de build.
8
8
  */
9
9
  export interface IOAuth2Service {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodefony/framework",
3
- "version": "10.0.0-alpha.2",
3
+ "version": "10.0.0-alpha.3",
4
4
  "description": "Le modèle de programmation Nodefony : routeur, contrôleurs, décorateurs et vues — HTTP et WebSocket dans le même contexte",
5
5
  "author": "Christophe CAMENSULI <ccamensuli@gmail.com>",
6
6
  "main": "./dist/index.js",
@@ -51,12 +51,12 @@
51
51
  "tslib": "2.8.1"
52
52
  },
53
53
  "devDependencies": {
54
- "@nodefony/http": "^10.0.0-alpha.2",
54
+ "@nodefony/http": "^10.0.0-alpha.3",
55
55
  "@types/chai": "5.2.3",
56
56
  "@types/node": "26.4.1",
57
57
  "@vitest/coverage-v8": "5.0.0",
58
58
  "chai": "6.2.2",
59
- "nodefony": "^10.0.0-alpha.2",
59
+ "nodefony": "^10.0.0-alpha.3",
60
60
  "rimraf": "6.1.3",
61
61
  "tsx": "4.23.13",
62
62
  "vitest": "5.0.0"
@@ -65,8 +65,8 @@
65
65
  "readmeFilename": "README.md",
66
66
  "contributors": [],
67
67
  "peerDependencies": {
68
- "@nodefony/http": "^10.0.0-alpha.2",
69
- "nodefony": "^10.0.0-alpha.2",
68
+ "@nodefony/http": "^10.0.0-alpha.3",
69
+ "nodefony": "^10.0.0-alpha.3",
70
70
  "zod": "^4.4.3"
71
71
  },
72
72
  "files": [