@haneinfo/frontend-auth 0.1.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/LICENSE +14 -0
- package/README.md +10 -0
- package/dist/server.d.ts +16 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +328 -0
- package/dist/server.js.map +1 -0
- package/package.json +44 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Copyright (c) 2026 Haneinfo. All Rights Reserved.
|
|
2
|
+
|
|
3
|
+
This software and associated documentation files (the "Software") are the proprietary and
|
|
4
|
+
confidential property of Haneinfo. No part of the Software may be copied, modified, merged,
|
|
5
|
+
published, distributed, sublicensed, or sold without the prior written permission of Haneinfo.
|
|
6
|
+
|
|
7
|
+
The Software is provided for internal use by Haneinfo and its authorized personnel only, and is
|
|
8
|
+
NOT licensed for external distribution or open-source use.
|
|
9
|
+
|
|
10
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
|
|
11
|
+
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
12
|
+
NONINFRINGEMENT. IN NO EVENT SHALL HANEINFO BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
13
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
|
14
|
+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @haneinfo/frontend-auth
|
|
2
|
+
|
|
3
|
+
Server-only NextAuth integration shared by Haneinfo Apps. Import from
|
|
4
|
+
`@haneinfo/frontend-auth/server`. Each App selects `oidc` or `local-auth` at deployment time and
|
|
5
|
+
passes its login page and optional Keycloak authorization scope to `createFrontendAuth()`.
|
|
6
|
+
|
|
7
|
+
The returned session callback exposes the stable refresh error code but never bearer or refresh
|
|
8
|
+
tokens. Server actions use `getAccessToken()`, `getRefreshToken()`, and
|
|
9
|
+
`getKeycloakEndSessionUrl()` as needed. Local auth refresh is single-flight and is persisted at
|
|
10
|
+
the NextAuth proxy boundary; an RSC render with a stale rotating token receives no bearer token.
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import { type NextAuthResult } from 'next-auth';
|
|
3
|
+
export interface FrontendAuthConfig {
|
|
4
|
+
provider: 'oidc' | 'local-auth';
|
|
5
|
+
signInPath?: string;
|
|
6
|
+
errorPath?: string;
|
|
7
|
+
keycloakAuthorizationScope?: string;
|
|
8
|
+
trustHost?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface FrontendAuthResult extends NextAuthResult {
|
|
11
|
+
getAccessToken(): Promise<string | undefined>;
|
|
12
|
+
getRefreshToken(): Promise<string | undefined>;
|
|
13
|
+
getKeycloakEndSessionUrl(postLogoutRedirectUri: string): Promise<string | undefined>;
|
|
14
|
+
}
|
|
15
|
+
export declare function createFrontendAuth(config: FrontendAuthConfig): FrontendAuthResult;
|
|
16
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAGrB,OAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAK1D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC9C,eAAe,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,wBAAwB,CAAC,qBAAqB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CACtF;AA4ID,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,kBAAkB,CA2PjF"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import 'server-only';
|
|
2
|
+
import { headers } from 'next/headers';
|
|
3
|
+
import NextAuth from 'next-auth';
|
|
4
|
+
import { getToken } from 'next-auth/jwt';
|
|
5
|
+
import Credentials from 'next-auth/providers/credentials';
|
|
6
|
+
import Keycloak from 'next-auth/providers/keycloak';
|
|
7
|
+
const REFRESH_ACCESS_TOKEN_ERROR = 'RefreshAccessTokenError';
|
|
8
|
+
function readRequiredEnv(name) {
|
|
9
|
+
const value = process.env[name];
|
|
10
|
+
if (!value)
|
|
11
|
+
throw new Error(`Missing required environment variable: ${name}`);
|
|
12
|
+
return value;
|
|
13
|
+
}
|
|
14
|
+
function localAuthUrl(path) {
|
|
15
|
+
return `${readRequiredEnv('NEXT_PUBLIC_API_URL')}${path}`;
|
|
16
|
+
}
|
|
17
|
+
function hasTokenResponse(value) {
|
|
18
|
+
if (!value || typeof value !== 'object')
|
|
19
|
+
return false;
|
|
20
|
+
const response = value;
|
|
21
|
+
return (typeof response.accessToken === 'string' &&
|
|
22
|
+
typeof response.expiresIn === 'number' &&
|
|
23
|
+
typeof response.refreshToken === 'string' &&
|
|
24
|
+
typeof response.refreshTokenExpiresIn === 'number' &&
|
|
25
|
+
typeof response.mustChangePassword === 'boolean');
|
|
26
|
+
}
|
|
27
|
+
function hasLoginResponse(value) {
|
|
28
|
+
if (!hasTokenResponse(value))
|
|
29
|
+
return false;
|
|
30
|
+
const response = value;
|
|
31
|
+
return (typeof response.userId === 'string' &&
|
|
32
|
+
typeof response.email === 'string' &&
|
|
33
|
+
(typeof response.name === 'string' || response.name === null));
|
|
34
|
+
}
|
|
35
|
+
// The backend's OidcStrategy validates the Keycloak access token directly (Bearer), not next-auth's
|
|
36
|
+
// own session cookie — the two are different tokens (202607-035a-oidc-only-auth.md). next-auth only
|
|
37
|
+
// refreshes its own session; refreshing the upstream Keycloak access token is this app's
|
|
38
|
+
// responsibility.
|
|
39
|
+
async function refreshKeycloakToken(token) {
|
|
40
|
+
try {
|
|
41
|
+
const issuer = readRequiredEnv('AUTH_KEYCLOAK_ISSUER');
|
|
42
|
+
const res = await fetch(`${issuer}/protocol/openid-connect/token`, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
|
45
|
+
body: new URLSearchParams({
|
|
46
|
+
grant_type: 'refresh_token',
|
|
47
|
+
client_id: readRequiredEnv('AUTH_KEYCLOAK_ID'),
|
|
48
|
+
client_secret: readRequiredEnv('AUTH_KEYCLOAK_SECRET'),
|
|
49
|
+
refresh_token: typeof token.refreshToken === 'string' ? token.refreshToken : '',
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
const refreshed = (await res.json());
|
|
53
|
+
if (!res.ok ||
|
|
54
|
+
typeof refreshed.access_token !== 'string' ||
|
|
55
|
+
!refreshed.access_token ||
|
|
56
|
+
typeof refreshed.expires_in !== 'number' ||
|
|
57
|
+
!Number.isFinite(refreshed.expires_in) ||
|
|
58
|
+
refreshed.expires_in <= 0 ||
|
|
59
|
+
(refreshed.refresh_token !== undefined && typeof refreshed.refresh_token !== 'string'))
|
|
60
|
+
throw new Error('Invalid OIDC refresh response');
|
|
61
|
+
return {
|
|
62
|
+
...token,
|
|
63
|
+
accessToken: refreshed.access_token,
|
|
64
|
+
accessTokenExpires: Date.now() + refreshed.expires_in * 1000,
|
|
65
|
+
refreshToken: refreshed.refresh_token ?? token.refreshToken,
|
|
66
|
+
error: undefined,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Surfaced via session.error — callers (api-client.ts) treat this as unauthenticated
|
|
71
|
+
// rather than sending a token that's guaranteed to be rejected.
|
|
72
|
+
return { ...token, error: REFRESH_ACCESS_TOKEN_ERROR };
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
async function refreshLocalAuthToken(token) {
|
|
76
|
+
try {
|
|
77
|
+
const refreshToken = typeof token.refreshToken === 'string' ? token.refreshToken : '';
|
|
78
|
+
if (!refreshToken)
|
|
79
|
+
throw new Error('Missing local refresh token');
|
|
80
|
+
const response = await fetch(localAuthUrl('/auth/refresh'), {
|
|
81
|
+
method: 'POST',
|
|
82
|
+
headers: { 'Content-Type': 'application/json' },
|
|
83
|
+
body: JSON.stringify({ refreshToken }),
|
|
84
|
+
cache: 'no-store',
|
|
85
|
+
});
|
|
86
|
+
const refreshed = (await response.json().catch(() => null));
|
|
87
|
+
if (!response.ok || !hasTokenResponse(refreshed))
|
|
88
|
+
throw new Error('Local token refresh failed');
|
|
89
|
+
return {
|
|
90
|
+
...token,
|
|
91
|
+
accessToken: refreshed.accessToken,
|
|
92
|
+
accessTokenExpires: Date.now() + refreshed.expiresIn * 1000,
|
|
93
|
+
refreshToken: refreshed.refreshToken,
|
|
94
|
+
mustChangePassword: refreshed.mustChangePassword,
|
|
95
|
+
error: undefined,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// The api-client sees no bearer token after this flag is set, while the session callback
|
|
100
|
+
// exposes only this stable error code to the UI. Neither path exposes the failed token.
|
|
101
|
+
return { ...token, error: REFRESH_ACCESS_TOKEN_ERROR };
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export function createFrontendAuth(config) {
|
|
105
|
+
const AUTH_PROVIDER = config.provider;
|
|
106
|
+
async function refreshAccessToken(token) {
|
|
107
|
+
return AUTH_PROVIDER === 'local-auth'
|
|
108
|
+
? refreshLocalAuthToken(token)
|
|
109
|
+
: refreshKeycloakToken(token);
|
|
110
|
+
}
|
|
111
|
+
// Next.js may render several server requests for one navigation in parallel. Local-auth's refresh
|
|
112
|
+
// token is single-use (rotating), so those requests must share one in-flight refresh rather than
|
|
113
|
+
// submitting the same old token concurrently — harmless-but-unnecessary for Keycloak's non-rotating
|
|
114
|
+
// refresh token, so applying it unconditionally keeps this one code path for both providers instead
|
|
115
|
+
// of two. The proxy is the persistence boundary; this map only prevents duplicate refreshes within
|
|
116
|
+
// one frontend process.
|
|
117
|
+
const refreshesInFlight = new Map();
|
|
118
|
+
function refreshAccessTokenOnce(token) {
|
|
119
|
+
const refreshToken = typeof token.refreshToken === 'string' ? token.refreshToken : '';
|
|
120
|
+
if (!refreshToken)
|
|
121
|
+
return refreshAccessToken(token);
|
|
122
|
+
const existing = refreshesInFlight.get(refreshToken);
|
|
123
|
+
if (existing)
|
|
124
|
+
return existing;
|
|
125
|
+
const refresh = refreshAccessToken(token).finally(() => {
|
|
126
|
+
refreshesInFlight.delete(refreshToken);
|
|
127
|
+
});
|
|
128
|
+
refreshesInFlight.set(refreshToken, refresh);
|
|
129
|
+
return refresh;
|
|
130
|
+
}
|
|
131
|
+
const providers = AUTH_PROVIDER === 'local-auth'
|
|
132
|
+
? [
|
|
133
|
+
Credentials({
|
|
134
|
+
credentials: {
|
|
135
|
+
email: { label: 'Email', type: 'email' },
|
|
136
|
+
password: { label: 'Password', type: 'password' },
|
|
137
|
+
},
|
|
138
|
+
async authorize(credentials) {
|
|
139
|
+
const email = typeof credentials?.email === 'string' ? credentials.email : '';
|
|
140
|
+
const password = typeof credentials?.password === 'string' ? credentials.password : '';
|
|
141
|
+
if (!email || !password)
|
|
142
|
+
return null;
|
|
143
|
+
const response = await fetch(localAuthUrl('/auth/login'), {
|
|
144
|
+
method: 'POST',
|
|
145
|
+
headers: { 'Content-Type': 'application/json' },
|
|
146
|
+
body: JSON.stringify({ email, password }),
|
|
147
|
+
cache: 'no-store',
|
|
148
|
+
});
|
|
149
|
+
const result = (await response.json().catch(() => null));
|
|
150
|
+
if (!response.ok || !hasLoginResponse(result)) {
|
|
151
|
+
return null;
|
|
152
|
+
}
|
|
153
|
+
return {
|
|
154
|
+
id: result.userId,
|
|
155
|
+
email: result.email,
|
|
156
|
+
name: result.name,
|
|
157
|
+
accessToken: result.accessToken,
|
|
158
|
+
refreshToken: result.refreshToken,
|
|
159
|
+
accessTokenExpires: Date.now() + result.expiresIn * 1000,
|
|
160
|
+
mustChangePassword: result.mustChangePassword,
|
|
161
|
+
};
|
|
162
|
+
},
|
|
163
|
+
}),
|
|
164
|
+
]
|
|
165
|
+
: [
|
|
166
|
+
Keycloak({
|
|
167
|
+
clientId: readRequiredEnv('AUTH_KEYCLOAK_ID'),
|
|
168
|
+
clientSecret: readRequiredEnv('AUTH_KEYCLOAK_SECRET'),
|
|
169
|
+
issuer: readRequiredEnv('AUTH_KEYCLOAK_ISSUER'),
|
|
170
|
+
...(config.keycloakAuthorizationScope
|
|
171
|
+
? { authorization: { params: { scope: config.keycloakAuthorizationScope } } }
|
|
172
|
+
: {}),
|
|
173
|
+
}),
|
|
174
|
+
];
|
|
175
|
+
const { handlers, auth, signIn, signOut, unstable_update } = NextAuth({
|
|
176
|
+
trustHost: config.trustHost ?? true,
|
|
177
|
+
session: { strategy: 'jwt' },
|
|
178
|
+
providers,
|
|
179
|
+
pages: {
|
|
180
|
+
signIn: config.signInPath ?? '/login',
|
|
181
|
+
// Without this, AuthError kinds other than sign-in (e.g. AccessDenied when
|
|
182
|
+
// Keycloak's per-client conditional-deny flow rejects the user, or a callback/token
|
|
183
|
+
// exchange failure) fall through to next-auth's own built-in error page instead of
|
|
184
|
+
// this app's translated /login?error= handling.
|
|
185
|
+
error: config.errorPath ?? config.signInPath ?? '/login',
|
|
186
|
+
},
|
|
187
|
+
callbacks: {
|
|
188
|
+
async jwt({ token, account, user }) {
|
|
189
|
+
// OIDC first sign-in: `account` carries the tokens Keycloak just issued. Checking
|
|
190
|
+
// `account.type === "oauth"` (not just truthiness) matters: Auth.js synthesizes a truthy
|
|
191
|
+
// `account` for the Credentials provider too (`type: "credentials"`, no token fields), so a
|
|
192
|
+
// bare `if (account)` would swallow every local-auth sign-in into this branch and silently
|
|
193
|
+
// produce a session with no bearer token at all.
|
|
194
|
+
if (account?.type === 'oauth' || account?.type === 'oidc') {
|
|
195
|
+
return {
|
|
196
|
+
...token,
|
|
197
|
+
accessToken: account.access_token,
|
|
198
|
+
refreshToken: account.refresh_token,
|
|
199
|
+
// Needed at logout time to build Keycloak's RP-initiated logout URL (id_token_hint) — see
|
|
200
|
+
// getKeycloakEndSessionUrl below. Never exposed via the session callback.
|
|
201
|
+
idToken: account.id_token,
|
|
202
|
+
accessTokenExpires: account.expires_at ? account.expires_at * 1000 : undefined,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
// local-auth first sign-in: the login response returned by authorize() (exposed here as
|
|
206
|
+
// `user`) is the source of the first JWT token values — `account` for this provider carries
|
|
207
|
+
// no usable token fields (see above).
|
|
208
|
+
if (user) {
|
|
209
|
+
const localUser = user;
|
|
210
|
+
return {
|
|
211
|
+
...token,
|
|
212
|
+
sub: localUser.id,
|
|
213
|
+
email: localUser.email,
|
|
214
|
+
name: localUser.name,
|
|
215
|
+
accessToken: localUser.accessToken,
|
|
216
|
+
refreshToken: localUser.refreshToken,
|
|
217
|
+
accessTokenExpires: localUser.accessTokenExpires,
|
|
218
|
+
mustChangePassword: localUser.mustChangePassword,
|
|
219
|
+
error: undefined,
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
// 30s skew margin so a request doesn't race the expiry boundary.
|
|
223
|
+
if (typeof token.accessTokenExpires === 'number' &&
|
|
224
|
+
Date.now() < token.accessTokenExpires - 30_000) {
|
|
225
|
+
return token;
|
|
226
|
+
}
|
|
227
|
+
return refreshAccessTokenOnce(token);
|
|
228
|
+
},
|
|
229
|
+
// Deliberately does NOT attach accessToken/refreshToken/error here. This callback's return
|
|
230
|
+
// value is exactly what GET /api/auth/session serves to any same-origin request — including an
|
|
231
|
+
// XSS payload — so putting a live backend bearer credential here would hand it to client-side
|
|
232
|
+
// JS. Server-only code that needs the token calls getAccessToken() below instead, which never
|
|
233
|
+
// goes through this callback and so never reaches that endpoint. `error` alone is safe to
|
|
234
|
+
// expose: it is a stable enum-like string, never a credential.
|
|
235
|
+
async session({ session, token }) {
|
|
236
|
+
return typeof token.error === 'string' ? { ...session, error: token.error } : session;
|
|
237
|
+
},
|
|
238
|
+
},
|
|
239
|
+
});
|
|
240
|
+
async function readSessionToken() {
|
|
241
|
+
return getToken({
|
|
242
|
+
req: { headers: await headers() },
|
|
243
|
+
secret: readRequiredEnv('AUTH_SECRET'),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
// Server-only: returns a valid access token for the current request, or undefined if there is no
|
|
247
|
+
// session or refresh failed. The encrypted next-auth JWT remains the only place bearer credentials
|
|
248
|
+
// are stored. The two providers need genuinely different strategies here, not just different
|
|
249
|
+
// backends for the same one — see the two implementations below.
|
|
250
|
+
async function getAccessToken() {
|
|
251
|
+
return AUTH_PROVIDER === 'local-auth' ? getAccessTokenLocalAuth() : getAccessTokenOidc();
|
|
252
|
+
}
|
|
253
|
+
// Keycloak's refresh token is non-rotating in dev-infra's realm (`revokeRefreshToken: false`), so
|
|
254
|
+
// refreshing here — computing a new access token for *this* request without a response boundary
|
|
255
|
+
// that can persist the replacement cookie — is harmless: the next request re-reads the same
|
|
256
|
+
// pre-refresh cookie and refreshes again, at the cost of an extra round trip, not a broken session.
|
|
257
|
+
// This WOULD break (mid-session logout) if rotation is ever turned on for Keycloak, at which point
|
|
258
|
+
// this needs the same proxy-based fix local-auth already has below.
|
|
259
|
+
async function getAccessTokenOidc() {
|
|
260
|
+
const token = await readSessionToken();
|
|
261
|
+
if (!token || typeof token.error === 'string')
|
|
262
|
+
return undefined;
|
|
263
|
+
if (typeof token.accessTokenExpires === 'number' &&
|
|
264
|
+
Date.now() < token.accessTokenExpires - 30_000) {
|
|
265
|
+
return typeof token.accessToken === 'string' ? token.accessToken : undefined;
|
|
266
|
+
}
|
|
267
|
+
const refreshed = await refreshKeycloakToken(token);
|
|
268
|
+
if (typeof refreshed.error === 'string')
|
|
269
|
+
return undefined;
|
|
270
|
+
return typeof refreshed.accessToken === 'string' ? refreshed.accessToken : undefined;
|
|
271
|
+
}
|
|
272
|
+
// local-auth's refresh token is single-use (rotating): refreshing it inline here, in a Server
|
|
273
|
+
// Component that cannot set cookies, would burn it without persisting the replacement anywhere —
|
|
274
|
+
// worse, re-submitting an already-rotated refresh token trips reuse-detection (202608-cd2d item 5)
|
|
275
|
+
// and revokes every session for the user. `src/proxy.ts` refreshes the JWT (via `auth()`'s own
|
|
276
|
+
// resolution, which invokes the `jwt` callback below) before the RSC tree renders, so the *next*
|
|
277
|
+
// request already carries a valid cookie — but there is no supported way to read the value that
|
|
278
|
+
// refresh just produced from within this render (see proxy.ts's comment for why). So: on the one
|
|
279
|
+
// request that actually triggers a rotation, this returns `undefined` — the caller (api-client.ts)
|
|
280
|
+
// treats that as unauthenticated for this render only; the next request works normally.
|
|
281
|
+
async function getAccessTokenLocalAuth() {
|
|
282
|
+
const token = await readSessionToken();
|
|
283
|
+
if (!token || typeof token.error === 'string')
|
|
284
|
+
return undefined;
|
|
285
|
+
if (typeof token.accessTokenExpires === 'number' &&
|
|
286
|
+
Date.now() < token.accessTokenExpires - 30_000) {
|
|
287
|
+
return typeof token.accessToken === 'string' ? token.accessToken : undefined;
|
|
288
|
+
}
|
|
289
|
+
return undefined;
|
|
290
|
+
}
|
|
291
|
+
// Server-only: reads the opaque refresh token so logout can revoke this browser session in the
|
|
292
|
+
// local-auth database before next-auth clears its encrypted session cookie. Meaningless under OIDC
|
|
293
|
+
// (Keycloak session revocation is not this app's concern) — callers only use this when
|
|
294
|
+
// AUTH_PROVIDER === "local-auth".
|
|
295
|
+
async function getRefreshToken() {
|
|
296
|
+
const token = await readSessionToken();
|
|
297
|
+
return token && typeof token.refreshToken === 'string' ? token.refreshToken : undefined;
|
|
298
|
+
}
|
|
299
|
+
// Server-only: builds Keycloak's RP-initiated logout URL (protocol/openid-connect/logout) for the
|
|
300
|
+
// current session's ID token, or undefined if there is no session/ID token to log out. Clearing only
|
|
301
|
+
// next-auth's own cookie leaves Keycloak's own SSO session cookie alive, so the next "Keycloak sign-in"
|
|
302
|
+
// click silently re-authenticates through it instead of showing the login form again — the caller
|
|
303
|
+
// must read this URL *before* clearing the next-auth cookie (this reads the session token from the
|
|
304
|
+
// request), then redirect the browser here instead of just calling signOut().
|
|
305
|
+
async function getKeycloakEndSessionUrl(postLogoutRedirectUri) {
|
|
306
|
+
if (AUTH_PROVIDER !== 'oidc')
|
|
307
|
+
return undefined;
|
|
308
|
+
const token = await readSessionToken();
|
|
309
|
+
const idToken = token && typeof token.idToken === 'string' ? token.idToken : undefined;
|
|
310
|
+
if (!idToken)
|
|
311
|
+
return undefined;
|
|
312
|
+
const url = new URL(`${readRequiredEnv('AUTH_KEYCLOAK_ISSUER')}/protocol/openid-connect/logout`);
|
|
313
|
+
url.searchParams.set('id_token_hint', idToken);
|
|
314
|
+
url.searchParams.set('post_logout_redirect_uri', postLogoutRedirectUri);
|
|
315
|
+
return url.toString();
|
|
316
|
+
}
|
|
317
|
+
return {
|
|
318
|
+
handlers,
|
|
319
|
+
auth,
|
|
320
|
+
signIn,
|
|
321
|
+
signOut,
|
|
322
|
+
unstable_update,
|
|
323
|
+
getAccessToken,
|
|
324
|
+
getRefreshToken,
|
|
325
|
+
getKeycloakEndSessionUrl,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,QAAiC,MAAM,WAAW,CAAC;AAC1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AAG,MAAM,gBAAgB,EAAE,CAAC;QACvC,MAAM,OAAO,GAAG,KAAK,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;QACvF,IAAI,CAAC,OAAO;YAAE,OAAO,SAAS,CAAC;QAE/B,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,GAAG,eAAe,CAAC,sBAAsB,CAAC,iCAAiC,CAC5E,CAAC;QACF,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAC/C,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC;QACxE,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IACxB,CAAC;IAED,OAAO;QACL,QAAQ;QACR,IAAI;QACJ,MAAM;QACN,OAAO;QACP,eAAe;QACf,cAAc;QACd,eAAe;QACf,wBAAwB;KACzB,CAAC;AACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@haneinfo/frontend-auth",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Shared server-side NextAuth integration for Haneinfo Apps",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
"./server": {
|
|
13
|
+
"types": "./dist/server.d.ts",
|
|
14
|
+
"default": "./dist/server.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"server-only": "^0.0.1"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"next": "^16.0.0",
|
|
22
|
+
"next-auth": "5.0.0-beta.32"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/node": "^24.13.0",
|
|
26
|
+
"next": "^16.3.1",
|
|
27
|
+
"next-auth": "5.0.0-beta.32",
|
|
28
|
+
"typescript": "^5.9.3",
|
|
29
|
+
"vitest": "^4.1.11"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22.0.0"
|
|
33
|
+
},
|
|
34
|
+
"license": "UNLICENSED",
|
|
35
|
+
"publishConfig": {
|
|
36
|
+
"registry": "https://registry.npmjs.org/",
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsc -p tsconfig.build.json",
|
|
41
|
+
"typecheck": "tsc --noEmit",
|
|
42
|
+
"test": "vitest run"
|
|
43
|
+
}
|
|
44
|
+
}
|