mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-22 16:13:12 +09:00
Allow pre-rename host tokens
Ease migration to the new controller/host naming by allowing tokens issued to the slave naming to be authenticated by the controller.
This commit is contained in:
1 parent
b4259f59cf
commit
10528fbb90
1 file changed
+4
-2
@@ -216,10 +216,12 @@ ${err.stack}`
|
|||||||
let tokenPayload = jwt.verify(
|
let tokenPayload = jwt.verify(
|
||||||
data.token,
|
data.token,
|
||||||
Buffer.from(this.controller.config.get("controller.auth_secret"), "base64"),
|
Buffer.from(this.controller.config.get("controller.auth_secret"), "base64"),
|
||||||
{ audience: "host" }
|
// migrate: allow pre-rename tokens issued to hosts before alpha-14
|
||||||
|
{ audience: ["host", "slave"] }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tokenPayload.host !== data.id) {
|
// migrate: allow pre-rename tokens issued to hosts before alpha-14
|
||||||
|
if ((tokenPayload.host !== undefined ? tokenPayload.host : tokenPayload.slave) !== data.id) {
|
||||||
throw new Error("missmatched host id");
|
throw new Error("missmatched host id");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user