fix(auth): respect INDIEKIT_ADMIN_URL for login redirects
This commit is contained in:
@@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
- The IndieKit admin is expected to run behind `/admin`.
|
- The IndieKit admin is expected to run behind `/admin`.
|
||||||
- Set `INDIEKIT_ADMIN_URL` to the public admin base URL, including trailing slash (example: `https://blog.giersig.eu/admin/`).
|
- Set `INDIEKIT_ADMIN_URL` to the public admin base URL, including trailing slash (example: `https://blog.giersig.eu/admin/`).
|
||||||
|
- When `INDIEKIT_ADMIN_URL` is set, config wires absolute auth endpoints/callback base (`/auth`, `/auth/token`, `/auth/introspect`) to that URL to keep login redirects on `/admin/*`.
|
||||||
- Login uses `PASSWORD_SECRET` (bcrypt hash), not `INDIEKIT_PASSWORD`.
|
- Login uses `PASSWORD_SECRET` (bcrypt hash), not `INDIEKIT_PASSWORD`.
|
||||||
- If no `PASSWORD_SECRET` exists yet, open `/admin/auth/new-password` once to generate it.
|
- If no `PASSWORD_SECRET` exists yet, open `/admin/auth/new-password` once to generate it.
|
||||||
- Post management UI should use `/posts` (`@indiekit/endpoint-posts.mountPath`).
|
- Post management UI should use `/posts` (`@indiekit/endpoint-posts.mountPath`).
|
||||||
|
|||||||
@@ -30,6 +30,9 @@ const githubActivityToken =
|
|||||||
const publicationBaseUrl = (
|
const publicationBaseUrl = (
|
||||||
process.env.PUBLICATION_URL || "https://blog.giersig.eu"
|
process.env.PUBLICATION_URL || "https://blog.giersig.eu"
|
||||||
).replace(/\/+$/, "");
|
).replace(/\/+$/, "");
|
||||||
|
const adminBaseUrl = (process.env.INDIEKIT_ADMIN_URL || "")
|
||||||
|
.trim()
|
||||||
|
.replace(/\/+$/, "");
|
||||||
|
|
||||||
let webmentionDomain = process.env.WEBMENTION_IO_DOMAIN;
|
let webmentionDomain = process.env.WEBMENTION_IO_DOMAIN;
|
||||||
if (!webmentionDomain) {
|
if (!webmentionDomain) {
|
||||||
@@ -45,6 +48,12 @@ export default {
|
|||||||
application: {
|
application: {
|
||||||
name: "Indiekit",
|
name: "Indiekit",
|
||||||
mongodbUrl: mongoUrl,
|
mongodbUrl: mongoUrl,
|
||||||
|
...(adminBaseUrl && {
|
||||||
|
url: adminBaseUrl,
|
||||||
|
authorizationEndpoint: `${adminBaseUrl}/auth`,
|
||||||
|
introspectionEndpoint: `${adminBaseUrl}/auth/introspect`,
|
||||||
|
tokenEndpoint: `${adminBaseUrl}/auth/token`,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
publication: {
|
publication: {
|
||||||
me: publicationBaseUrl,
|
me: publicationBaseUrl,
|
||||||
|
|||||||
Reference in New Issue
Block a user