mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-20 15:51:40 +02:00
integration: update DeleteAuthKey to use ID
This commit is contained in:
committed by
Kristoffer Dalby
parent
1325fd8b27
commit
db6882b5f5
@@ -530,7 +530,7 @@ func TestAuthKeyDeleteKey(t *testing.T) {
|
|||||||
// DELETE the pre-auth key using the API
|
// DELETE the pre-auth key using the API
|
||||||
t.Logf("Deleting pre-auth key ID %d using API", authKeyID)
|
t.Logf("Deleting pre-auth key ID %d using API", authKeyID)
|
||||||
|
|
||||||
err = headscale.DeleteAuthKey(userID, authKeyString)
|
err = headscale.DeleteAuthKey(authKeyID)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
t.Logf("Successfully deleted auth key")
|
t.Logf("Successfully deleted auth key")
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ type ControlServer interface {
|
|||||||
CreateAuthKey(user uint64, reusable bool, ephemeral bool) (*v1.PreAuthKey, error)
|
CreateAuthKey(user uint64, reusable bool, ephemeral bool) (*v1.PreAuthKey, error)
|
||||||
CreateAuthKeyWithTags(user uint64, reusable bool, ephemeral bool, tags []string) (*v1.PreAuthKey, error)
|
CreateAuthKeyWithTags(user uint64, reusable bool, ephemeral bool, tags []string) (*v1.PreAuthKey, error)
|
||||||
CreateAuthKeyWithOptions(opts hsic.AuthKeyOptions) (*v1.PreAuthKey, error)
|
CreateAuthKeyWithOptions(opts hsic.AuthKeyOptions) (*v1.PreAuthKey, error)
|
||||||
DeleteAuthKey(user uint64, key string) error
|
DeleteAuthKey(id uint64) error
|
||||||
ListNodes(users ...string) ([]*v1.Node, error)
|
ListNodes(users ...string) ([]*v1.Node, error)
|
||||||
DeleteNode(nodeID uint64) error
|
DeleteNode(nodeID uint64) error
|
||||||
NodesByUser() (map[string][]*v1.Node, error)
|
NodesByUser() (map[string][]*v1.Node, error)
|
||||||
|
|||||||
@@ -1162,18 +1162,16 @@ func (t *HeadscaleInContainer) CreateAuthKeyWithTags(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteAuthKey deletes an "authorisation key" for a User.
|
// DeleteAuthKey deletes an "authorisation key" by ID.
|
||||||
func (t *HeadscaleInContainer) DeleteAuthKey(
|
func (t *HeadscaleInContainer) DeleteAuthKey(
|
||||||
user uint64,
|
id uint64,
|
||||||
key string,
|
|
||||||
) error {
|
) error {
|
||||||
command := []string{
|
command := []string{
|
||||||
"headscale",
|
"headscale",
|
||||||
"--user",
|
|
||||||
strconv.FormatUint(user, 10),
|
|
||||||
"preauthkeys",
|
"preauthkeys",
|
||||||
"delete",
|
"delete",
|
||||||
key,
|
"--id",
|
||||||
|
strconv.FormatUint(id, 10),
|
||||||
"--output",
|
"--output",
|
||||||
"json",
|
"json",
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user