@snokam/auth 5.4.5 → 5.5.0
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/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.5.0](https://github.com/snokam/components/compare/@snokam/auth@5.4.5...@snokam/auth@5.5.0) (2026-10-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **lint:** ban code comments + fix mobile fill in the Olaf host ([#3015](https://github.com/snokam/components/issues/3015)) ([938549b](https://github.com/snokam/components/commit/938549b8c1ed68cdc49be19cc168c1440c371199))
|
|
11
|
+
|
|
6
12
|
## [5.4.5](https://github.com/snokam/components/compare/@snokam/auth@5.4.4...@snokam/auth@5.4.5) (2026-10-22)
|
|
7
13
|
|
|
8
14
|
**Note:** Version bump only for package @snokam/auth
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@snokam/auth",
|
|
3
3
|
"description": "Snøkam auth components",
|
|
4
|
-
"version": "5.
|
|
4
|
+
"version": "5.5.0",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
7
7
|
"files": [
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"@snokam/employees-client": "^1.3.0",
|
|
27
27
|
"next-auth": "4.24.15",
|
|
28
28
|
"path-to-regexp": "^8.4.2",
|
|
29
|
-
"@snokam/platform-client": "5.3.1",
|
|
30
|
-
"@snokam/react-query": "1.1.0",
|
|
31
|
-
"@snokam/sanity-page-content": "6.5.6",
|
|
32
29
|
"@snokam/identity": "1.1.0",
|
|
33
|
-
"@snokam/
|
|
34
|
-
"@snokam/
|
|
30
|
+
"@snokam/react-query": "1.1.0",
|
|
31
|
+
"@snokam/sanity-page-content": "6.6.0",
|
|
32
|
+
"@snokam/tenant": "4.4.0",
|
|
33
|
+
"@snokam/ui": "6.4.0",
|
|
34
|
+
"@snokam/platform-client": "5.3.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"next": "16.3.8",
|
package/src/hooks.ts
CHANGED
|
@@ -102,7 +102,6 @@ export function useAuth() {
|
|
|
102
102
|
const { data: rawSession, status, update } = useSession();
|
|
103
103
|
const { active } = useImpersonation();
|
|
104
104
|
|
|
105
|
-
// A host of another business holds only the Vis som session, never the actor's own sign-in.
|
|
106
105
|
const session = useMemo(() => {
|
|
107
106
|
if (!active) return rawSession;
|
|
108
107
|
return {
|
|
@@ -2,8 +2,6 @@ import { open, seal } from "../ticket/seal.ts";
|
|
|
2
2
|
|
|
3
3
|
const PURPOSE = "impersonation-pass";
|
|
4
4
|
|
|
5
|
-
// A host of another business never gets the actor's own sign-in, so this sealed, host-bound pass
|
|
6
|
-
// is what tells the auth middleware that the host holds a Vis som session.
|
|
7
5
|
export function sealPass(
|
|
8
6
|
host: string,
|
|
9
7
|
tokenId: string,
|
package/src/options/request.ts
CHANGED
|
@@ -17,7 +17,6 @@ export function requestHost(req?: { headers?: HeaderBag }): string | undefined {
|
|
|
17
17
|
export function requestClientIp(req?: {
|
|
18
18
|
headers?: HeaderBag;
|
|
19
19
|
}): string | undefined {
|
|
20
|
-
// Trusted edge headers first (Front Door, unspoofable); rightmost XFF entry as a fallback.
|
|
21
20
|
const edge =
|
|
22
21
|
first(req?.headers, "x-azure-clientip") ??
|
|
23
22
|
first(req?.headers, "x-azure-socketip");
|
|
@@ -12,11 +12,6 @@ import { exchangeSsoToken } from "../sso/exchange";
|
|
|
12
12
|
export type TokenResult =
|
|
13
13
|
{ accessToken: string; expiresOn: number } | { error: Response };
|
|
14
14
|
|
|
15
|
-
/**
|
|
16
|
-
* Resolves the SIGNED-IN admin's own product access token (never the impersonation token). Shared
|
|
17
|
-
* by the token handler and the impersonation start/end handlers so the mint/end calls to the
|
|
18
|
-
* platform are authenticated as the real admin.
|
|
19
|
-
*/
|
|
20
15
|
export async function resolveAccessToken(
|
|
21
16
|
authConfig: Auth.Config,
|
|
22
17
|
request: Request
|
|
@@ -16,7 +16,6 @@ export function safeCallbackTarget(
|
|
|
16
16
|
return AUTH_FLOW.test(target) ? "/" : target;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// A callbackUrl already carries the app's basePath; the Next router would add it again.
|
|
20
19
|
export function callbackDestination(
|
|
21
20
|
callbackUrl: string | null,
|
|
22
21
|
origin: string
|
|
@@ -15,11 +15,6 @@ function isMode(value: unknown): value is ColorSchemeMode {
|
|
|
15
15
|
return MODES.includes(value as ColorSchemeMode);
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
/**
|
|
19
|
-
* Seeds the page theme from the effective user's saved settings.colorScheme. The token handler
|
|
20
|
-
* swaps in the impersonation token during a view-as session, so /me is already the target's
|
|
21
|
-
* record and their theme applies without any impersonation-specific code here.
|
|
22
|
-
*/
|
|
23
18
|
export function EmployeeThemeSync() {
|
|
24
19
|
const { isAuthenticated, getToken } = useAuth();
|
|
25
20
|
const { setMode } = useAdminTheme();
|
|
@@ -38,7 +33,6 @@ export function EmployeeThemeSync() {
|
|
|
38
33
|
[basePath, isAuthenticated, getToken]
|
|
39
34
|
);
|
|
40
35
|
|
|
41
|
-
// Same client name and param as every app's useEmployeesQuery, so this shares their cache entry.
|
|
42
36
|
const { data } = useClientQuery({
|
|
43
37
|
name: "Employees",
|
|
44
38
|
client,
|