create-ampless 1.0.0-beta.155 → 1.0.0-beta.157
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.
|
@@ -9,21 +9,22 @@
|
|
|
9
9
|
//
|
|
10
10
|
// ── Passkeys (WebAuthn) ──────────────────────────────────────────────
|
|
11
11
|
//
|
|
12
|
-
// Passkeys are ENABLED BY DEFAULT
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// `
|
|
12
|
+
// Passkeys are ENABLED BY DEFAULT. `amplify/auth/resource.ts` auto-
|
|
13
|
+
// derives the WebAuthn Relying Party ID from `cms.config.ts` `site.url`
|
|
14
|
+
// in Amplify Hosting pipeline builds, and uses `localhost` (auto-
|
|
15
|
+
// resolved by Amplify) in `ampx sandbox`. This file is usually unneeded
|
|
16
|
+
// for passkeys.
|
|
16
17
|
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// domain (no protocol, no path) the operators visit:
|
|
18
|
+
// Set `webAuthn: { relyingPartyId: 'admin.example.com' }` ONLY when the
|
|
19
|
+
// admin is served from a different subdomain than `site.url` (e.g. site
|
|
20
|
+
// is at `example.com` but the admin CDN origin is `admin.example.com`).
|
|
21
21
|
//
|
|
22
22
|
// export const authCustomizations: Pick<AmplessAuthConfigOpts, 'webAuthn'> = {
|
|
23
23
|
// webAuthn: { relyingPartyId: 'admin.example.com' },
|
|
24
24
|
// }
|
|
25
25
|
//
|
|
26
|
-
// To turn passkeys off entirely (password-only sign-in
|
|
26
|
+
// To turn passkeys off entirely (password-only sign-in AND removes the
|
|
27
|
+
// passkey UI from the admin completely):
|
|
27
28
|
//
|
|
28
29
|
// export const authCustomizations: Pick<AmplessAuthConfigOpts, 'webAuthn'> = {
|
|
29
30
|
// webAuthn: false,
|
|
@@ -33,6 +34,9 @@
|
|
|
33
34
|
// invalidates every existing credential — they'll have to register
|
|
34
35
|
// again from the account page. The password flow always stays available
|
|
35
36
|
// as the fallback. See `docs/passkeys.md`.
|
|
37
|
+
//
|
|
38
|
+
// ⚠️ cms.config.ts must not import theme CSS or browser-only modules —
|
|
39
|
+
// it is loaded at CDK synth time when deriving the RP ID.
|
|
36
40
|
|
|
37
41
|
import type { AmplessAuthConfigOpts } from '@ampless/backend'
|
|
38
42
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineAuth } from '@aws-amplify/backend'
|
|
2
|
-
import { amplessAuthConfig } from '@ampless/backend'
|
|
2
|
+
import { amplessAuthConfig, resolveWebAuthn } from '@ampless/backend'
|
|
3
3
|
import { postConfirmation } from './post-confirmation/resource.js'
|
|
4
4
|
import { authCustomizations } from './resource.custom.js'
|
|
5
5
|
|
|
@@ -12,9 +12,23 @@ import { authCustomizations } from './resource.custom.js'
|
|
|
12
12
|
// import-path verifier requires it to live at amplify/auth/resource.ts.
|
|
13
13
|
// `amplessAuthConfig` just returns the props object.
|
|
14
14
|
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
15
|
+
// The WebAuthn Relying Party ID is auto-derived from `cms.config.ts`
|
|
16
|
+
// `site.url` in Amplify Hosting pipeline builds. In sandbox (`ampx
|
|
17
|
+
// sandbox`) the RP ID stays `localhost` (Amplify auto-resolves it).
|
|
18
|
+
// Override with `webAuthn: { relyingPartyId }` in resource.custom.ts
|
|
19
|
+
// only when the admin is served from a different subdomain than site.url.
|
|
20
|
+
import cmsConfig from '../../cms.config'
|
|
21
|
+
|
|
22
|
+
const { webAuthn: webAuthnOverride, ...otherAuthCustomizations } = authCustomizations
|
|
23
|
+
|
|
18
24
|
export const auth = defineAuth(
|
|
19
|
-
amplessAuthConfig({
|
|
25
|
+
amplessAuthConfig({
|
|
26
|
+
postConfirmation,
|
|
27
|
+
...otherAuthCustomizations,
|
|
28
|
+
webAuthn: resolveWebAuthn({
|
|
29
|
+
override: webAuthnOverride,
|
|
30
|
+
siteUrl: cmsConfig.site.url,
|
|
31
|
+
isPipeline: Boolean(process.env.AWS_BRANCH),
|
|
32
|
+
}),
|
|
33
|
+
})
|
|
20
34
|
)
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"@ampless/plugin-schema-jsonld": "^0.1.1-beta.31",
|
|
37
37
|
"@ampless/plugin-seo": "^0.2.0-beta.52",
|
|
38
38
|
"@ampless/plugin-webhook": "^0.2.0-beta.53",
|
|
39
|
-
"@ampless/admin": "^1.0.0-beta.
|
|
40
|
-
"@ampless/backend": "^1.0.0-beta.
|
|
39
|
+
"@ampless/admin": "^1.0.0-beta.92",
|
|
40
|
+
"@ampless/backend": "^1.0.0-beta.78",
|
|
41
41
|
"@ampless/runtime": "^1.0.0-beta.61",
|
|
42
42
|
"@digital-go-jp/tailwind-theme-plugin": "^0.3.4",
|
|
43
43
|
"ampless": "^1.0.0-beta.52",
|