mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 02:57:59 +00:00
Use WriteWithContext in auth helpers (#14775)
This commit is contained in:
committed by
GitHub
parent
16a23cc317
commit
7d520d4022
@@ -68,13 +68,17 @@ func NewKubernetesAuth(roleName string, opts ...LoginOption) (*KubernetesAuth, e
|
||||
}
|
||||
|
||||
func (a *KubernetesAuth) Login(ctx context.Context, client *api.Client) (*api.Secret, error) {
|
||||
if ctx == nil {
|
||||
ctx = context.Background()
|
||||
}
|
||||
|
||||
loginData := map[string]interface{}{
|
||||
"jwt": a.serviceAccountToken,
|
||||
"role": a.roleName,
|
||||
}
|
||||
|
||||
path := fmt.Sprintf("auth/%s/login", a.mountPath)
|
||||
resp, err := client.Logical().Write(path, loginData)
|
||||
resp, err := client.Logical().WriteWithContext(ctx, path, loginData)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to log in with Kubernetes auth: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user