mirror of
https://github.com/bpg/terraform-provider-proxmox.git
synced 2025-06-30 18:42:58 +00:00
fix: prevent authenticating multiple times in parallel (#1168)
Signed-off-by: hrmny <8845940+ForsakenHarmony@users.noreply.github.com>
This commit is contained in:
parent
a2f055a916
commit
e87bc4b941
@ -14,6 +14,7 @@ import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"sync"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-log/tflog"
|
||||
|
||||
@ -24,6 +25,8 @@ type ticketAuthenticator struct {
|
||||
conn *Connection
|
||||
authRequest string
|
||||
authData *AuthenticationResponseData
|
||||
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// NewTicketAuthenticator returns a new ticket authenticator.
|
||||
@ -46,6 +49,9 @@ func NewTicketAuthenticator(conn *Connection, creds *Credentials) (Authenticator
|
||||
}
|
||||
|
||||
func (t *ticketAuthenticator) authenticate(ctx context.Context) (*AuthenticationResponseData, error) {
|
||||
t.mu.Lock()
|
||||
defer t.mu.Unlock()
|
||||
|
||||
if t.authData != nil {
|
||||
return t.authData, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user