@tidecloak/create-nextjs 0.12.14 → 0.12.15
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/README.md +6 -6
- package/init/realm.json +1 -1
- package/init/tcinit.sh +1 -1
- package/package.json +2 -2
- package/template-js-app/package.json +1 -1
- package/template-ts-app/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,8 @@ Jump to:
|
|
|
10
10
|
|
|
11
11
|
Secure your Next.js app with TideCloak: authentication, session management, data encryption, and edge-middleware integration all in minutes.
|
|
12
12
|
|
|
13
|
+
[](https://www.youtube.com/watch?v=dVpDUF_XJdw "Provably secure your Next.js apps in 5 mins, with TideCloak")
|
|
14
|
+
|
|
13
15
|
### 1. Prerequisites
|
|
14
16
|
|
|
15
17
|
Before you begin, ensure you have:
|
|
@@ -208,8 +210,7 @@ No additional install-middleware is included in `@tidecloak/nextjs`.
|
|
|
208
210
|
|
|
209
211
|
#### Options
|
|
210
212
|
|
|
211
|
-
* **`config`** (`TidecloakConfig`): Your
|
|
212
|
-
* **`publicRoutes`** (`RoutePattern[]`): Paths to bypass authentication (strings/globs/regex/functions).
|
|
213
|
+
* **`config`** (`TidecloakConfig`): Your Tidecloak adapter JSON (downloaded from your TideCloak client settings).
|
|
213
214
|
* **`protectedRoutes`** (`ProtectedRoutesMap`): Map of path patterns to arrays of required roles.
|
|
214
215
|
* **`onRequest`**<br>`(ctx: { token: string | null }, req: NextRequest) => NextResponse | void`<br>Hook before auth logic; can short-circuit by returning a `NextResponse`.
|
|
215
216
|
* **`onSuccess`**<br>`(ctx: { payload: Record<string, any> }, req: NextRequest) => NextResponse | void`<br>Hook after successful auth & role checks; override the response by returning one.
|
|
@@ -222,12 +223,11 @@ Place the following `middleware.ts` at your project root (works for both Pages a
|
|
|
222
223
|
|
|
223
224
|
```ts
|
|
224
225
|
import { NextResponse } from 'next/server';
|
|
225
|
-
import
|
|
226
|
+
import tidecloakConfig from './tidecloakAdapter.json';
|
|
226
227
|
import { createTideCloakMiddleware } from '@tidecloak/nextjs/server/tidecloakMiddleware';
|
|
227
228
|
|
|
228
229
|
export default createTideCloakMiddleware({
|
|
229
|
-
config:
|
|
230
|
-
publicRoutes: ['/', '/about'],
|
|
230
|
+
config: tidecloakConfig,
|
|
231
231
|
protectedRoutes: {
|
|
232
232
|
'/admin/*': ['admin'],
|
|
233
233
|
'/api/private/*': ['user'],
|
|
@@ -289,7 +289,7 @@ export async function verifyTideCloakToken(config, token, allowedRoles = []) {
|
|
|
289
289
|
|
|
290
290
|
**Parameters:**
|
|
291
291
|
|
|
292
|
-
* `config` (`object`): Your TideCloak adapter JSON (parsed
|
|
292
|
+
* `config` (`object`): Your TideCloak adapter JSON (parsed Tidecloak client adapter config).
|
|
293
293
|
* `token` (`string`): Access token string to verify.
|
|
294
294
|
* `allowedRoles` (`string[]`, optional): Array of realm or client roles; user must have at least one.
|
|
295
295
|
|
package/init/realm.json
CHANGED
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"providerId": "declarative-user-profile",
|
|
112
112
|
"config": {
|
|
113
113
|
"kc.user.profile.config": [
|
|
114
|
-
"{\"attributes\":[{\"name\":\"username\",\"displayName\":\"${username}\",\"validations\":{\"length\":{\"min\":3,\"max\":255},\"username-prohibited-characters\":{},\"up-username-not-idn-homograph\":{}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"email\",\"displayName\":\"${email}\",\"validations\":{\"email\":{},\"length\":{\"max\":255}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"firstName\",\"displayName\":\"${firstName}\",\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"lastName\",\"displayName\":\"${lastName}\",\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false}],\"groups\":[{\"name\":\"user-metadata\",\"displayHeader\":\"User metadata\",\"displayDescription\":\"Attributes, which refer to user metadata\"}]}"
|
|
114
|
+
"{\"attributes\":[{\"name\":\"username\",\"displayName\":\"${username}\",\"validations\":{\"length\":{\"min\":3,\"max\":255},\"username-prohibited-characters\":{},\"up-username-not-idn-homograph\":{}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"email\",\"displayName\":\"${email}\",\"validations\":{\"email\":{},\"length\":{\"max\":255}},\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"firstName\",\"displayName\":\"${firstName}\",\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false},{\"name\":\"lastName\",\"displayName\":\"${lastName}\",\"permissions\":{\"view\":[\"admin\",\"user\"],\"edit\":[\"admin\",\"user\"]},\"multivalued\":false}],\"groups\":[{\"name\":\"user-metadata\",\"displayHeader\":\"User metadata\",\"displayDescription\":\"Attributes, which refer to user metadata\"}],\"unmanagedAttributePolicy\":\"ENABLED\"}"
|
|
115
115
|
]
|
|
116
116
|
}
|
|
117
117
|
}
|
package/init/tcinit.sh
CHANGED
|
@@ -179,7 +179,7 @@ INVITE_LINK=$(curl -s -X POST \
|
|
|
179
179
|
-d '["link-tide-account-action"]')
|
|
180
180
|
|
|
181
181
|
echo "🔗 Invite link: ${INVITE_LINK}"
|
|
182
|
-
echo "→
|
|
182
|
+
echo "→ Use (or send) this URL to link the first admin to their account."
|
|
183
183
|
|
|
184
184
|
MAX_TRIES=3
|
|
185
185
|
attempt=1
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tidecloak/create-nextjs",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.15",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "Scaffold a TideCloak-ready Next.js app with optional IAM setup and working auth
|
|
5
|
+
"description": "Scaffold a TideCloak-ready Next.js app with optional IAM setup and working auth - start building instantly with a live example",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-nextjs": "./dist/cjs/create.cjs"
|
|
8
8
|
},
|