mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-18 14:59:54 +02:00
integration: support auth keys without user
Add AuthKeyOptions to create auth keys owned by tags only.
This commit is contained in:
committed by
Kristoffer Dalby
parent
3b4b9a4436
commit
740d2b5a2c
@@ -478,6 +478,22 @@ func (s *Scenario) CreatePreAuthKey(
|
||||
return nil, fmt.Errorf("failed to create user: %w", errNoHeadscaleAvailable)
|
||||
}
|
||||
|
||||
// CreatePreAuthKeyWithOptions creates a "pre authorised key" with the specified options
|
||||
// to be created in the Headscale instance on behalf of the Scenario.
|
||||
func (s *Scenario) CreatePreAuthKeyWithOptions(opts hsic.AuthKeyOptions) (*v1.PreAuthKey, error) {
|
||||
headscale, err := s.Headscale()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create preauth key with options: %w", errNoHeadscaleAvailable)
|
||||
}
|
||||
|
||||
key, err := headscale.CreateAuthKeyWithOptions(opts)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create preauth key with options: %w", err)
|
||||
}
|
||||
|
||||
return key, nil
|
||||
}
|
||||
|
||||
// CreatePreAuthKeyWithTags creates a "pre authorised key" with the specified tags
|
||||
// to be created in the Headscale instance on behalf of the Scenario.
|
||||
func (s *Scenario) CreatePreAuthKeyWithTags(
|
||||
|
||||
Reference in New Issue
Block a user