@luxfi/ui 7.4.3 → 7.4.4
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.
- package/dist/iam.cjs +1 -1
- package/dist/iam.js +1 -1
- package/dist/identity.cjs +1 -1
- package/dist/identity.js +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/iam.ts +16 -2
- package/src/identity.tsx +6 -2
package/dist/iam.cjs
CHANGED
|
@@ -134,7 +134,7 @@ var IamError = class extends Error {
|
|
|
134
134
|
};
|
|
135
135
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
136
136
|
function isSignedOut(status, msg) {
|
|
137
|
-
return status === 401 ||
|
|
137
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
138
138
|
}
|
|
139
139
|
function iamBase(host) {
|
|
140
140
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/dist/iam.js
CHANGED
|
@@ -132,7 +132,7 @@ var IamError = class extends Error {
|
|
|
132
132
|
};
|
|
133
133
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
134
134
|
function isSignedOut(status, msg) {
|
|
135
|
-
return status === 401 ||
|
|
135
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
136
136
|
}
|
|
137
137
|
function iamBase(host) {
|
|
138
138
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/dist/identity.cjs
CHANGED
|
@@ -160,7 +160,7 @@ var IamError = class extends Error {
|
|
|
160
160
|
};
|
|
161
161
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
162
162
|
function isSignedOut(status, msg) {
|
|
163
|
-
return status === 401 ||
|
|
163
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
164
164
|
}
|
|
165
165
|
function iamBase(host) {
|
|
166
166
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/dist/identity.js
CHANGED
|
@@ -139,7 +139,7 @@ var IamError = class extends Error {
|
|
|
139
139
|
};
|
|
140
140
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
141
141
|
function isSignedOut(status, msg) {
|
|
142
|
-
return status === 401 ||
|
|
142
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
143
143
|
}
|
|
144
144
|
function iamBase(host) {
|
|
145
145
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/dist/index.cjs
CHANGED
|
@@ -288,7 +288,7 @@ var IamError = class extends Error {
|
|
|
288
288
|
};
|
|
289
289
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
290
290
|
function isSignedOut(status, msg) {
|
|
291
|
-
return status === 401 ||
|
|
291
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
292
292
|
}
|
|
293
293
|
function iamBase(host) {
|
|
294
294
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/dist/index.js
CHANGED
|
@@ -260,7 +260,7 @@ var IamError = class extends Error {
|
|
|
260
260
|
};
|
|
261
261
|
var SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
262
262
|
function isSignedOut(status, msg) {
|
|
263
|
-
return status === 401 ||
|
|
263
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
264
264
|
}
|
|
265
265
|
function iamBase(host) {
|
|
266
266
|
const wl = typeof host === "object" && host !== null ? host : resolveWhiteLabel(host);
|
package/package.json
CHANGED
package/src/iam.ts
CHANGED
|
@@ -70,11 +70,25 @@ export class IamError extends Error {
|
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* "No session" — as opposed to "a session that may not do this".
|
|
75
|
+
*
|
|
76
|
+
* IAM says it two ways: 401, and (measured against lux.id) HTTP **200** with
|
|
77
|
+
* `{"status":"error","msg":"please sign in first"}`, which is what both a
|
|
78
|
+
* missing and a malformed bearer get. So the message has to be read, not just
|
|
79
|
+
* the status.
|
|
80
|
+
*
|
|
81
|
+
* 403 is deliberately NOT here. `get-organizations` answers 403 to an ordinary
|
|
82
|
+
* signed-in user — listing the tenant table is a super-admin read — and folding
|
|
83
|
+
* that into "signed out" logged the user out of the chrome: get-account had
|
|
84
|
+
* already succeeded, then the org read's 403 wiped the account and every
|
|
85
|
+
* switcher offered "Sign in" to somebody who was signed in. Forbidden means
|
|
86
|
+
* signed in and not allowed; the caller falls back to the org it can see.
|
|
87
|
+
*/
|
|
74
88
|
const SIGNED_OUT = /please sign in|authentication required|unauthorized/i;
|
|
75
89
|
|
|
76
90
|
function isSignedOut(status: number, msg: string): boolean {
|
|
77
|
-
return status === 401 ||
|
|
91
|
+
return status === 401 || SIGNED_OUT.test(msg);
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
/** The IAM API root for a host — `lux.cloud` → `https://lux.id/v1/iam`. */
|
package/src/identity.tsx
CHANGED
|
@@ -181,8 +181,12 @@ export const IdentityProvider = ({
|
|
|
181
181
|
return;
|
|
182
182
|
}
|
|
183
183
|
setAccount(me);
|
|
184
|
-
// A member who cannot list the tenant table still has their OWN org
|
|
185
|
-
//
|
|
184
|
+
// A member who cannot list the tenant table still has their OWN org.
|
|
185
|
+
// `get-organizations` is a super-admin read and answers 403 to everyone
|
|
186
|
+
// else (measured on lux.id with a real z@lux.network bearer), so this is
|
|
187
|
+
// the COMMON path, not an edge case: fall back to the org the account
|
|
188
|
+
// itself names rather than showing an empty switcher — or, worse,
|
|
189
|
+
// treating the refusal as "not signed in".
|
|
186
190
|
const rows = await iam.organizations(call).catch((e: unknown) => {
|
|
187
191
|
if (e instanceof IamError && !e.unauthenticated) return [ { owner: 'admin', name: me.owner } ];
|
|
188
192
|
throw e;
|