mirror of
https://github.com/tale/headplane.git
synced 2026-07-26 07:48:14 +00:00
add tag-only preauth keys for headscale 0.28
allows creating keys with acl tags but no user
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
import { getRuntimeClient, HS_VERSIONS } from "./setup/env";
|
||||
import { getBootstrapClient, getRuntimeClient, HS_VERSIONS } from "./setup/env";
|
||||
|
||||
describe.sequential.for(HS_VERSIONS)("Headscale %s: Pre-auth Keys", (version) => {
|
||||
test("pre-auth keys can be created", async () => {
|
||||
@@ -36,6 +36,23 @@ describe.sequential.for(HS_VERSIONS)("Headscale %s: Pre-auth Keys", (version) =>
|
||||
expect(preAuthKey.aclTags.sort()).toEqual(aclTags.sort());
|
||||
});
|
||||
|
||||
test("tag-only pre-auth keys (0.28+)", async (context) => {
|
||||
const bootstrap = await getBootstrapClient(version);
|
||||
if (!bootstrap.clientHelpers.isAtleast("0.28.0")) {
|
||||
context.skip();
|
||||
}
|
||||
|
||||
const client = await getRuntimeClient(version);
|
||||
const aclTags = ["tag:server", "tag:prod"];
|
||||
const preAuthKey = await client.createPreAuthKey(null, false, true, null, aclTags);
|
||||
|
||||
expect(preAuthKey).toBeDefined();
|
||||
expect(preAuthKey.user).toBeNull();
|
||||
expect(preAuthKey.ephemeral).toBe(false);
|
||||
expect(preAuthKey.reusable).toBe(true);
|
||||
expect(preAuthKey.aclTags.sort()).toEqual(aclTags.sort());
|
||||
});
|
||||
|
||||
test("pre-auth keys can be listed", async () => {
|
||||
const client = await getRuntimeClient(version);
|
||||
const [preAuthKeyUser] = await client.getUsers(undefined, "preauthkeyuser@");
|
||||
|
||||
Reference in New Issue
Block a user