Skip to content

Commit 362380b

Browse files
committed
Document thread-safety guarantees for outgoing auth
Add explicit documentation that RegisterStrategy and AuthenticateRequest are safe for concurrent use, and that Strategy implementations must be thread-safe.
1 parent 8ebe826 commit 362380b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pkg/vmcp/auth/outgoing_authenticator.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,12 @@ import (
1111
// DefaultOutgoingAuthenticator is a thread-safe implementation of OutgoingAuthenticator
1212
// that maintains a registry of authentication strategies.
1313
//
14+
// Thread-safety: Safe for concurrent calls to RegisterStrategy and AuthenticateRequest.
15+
// Strategy implementations must be thread-safe as they are called concurrently.
16+
// It uses sync.RWMutex for thread-safety as HTTP servers are inherently concurrent.
17+
//
1418
// This authenticator supports dynamic registration of strategies and dispatches
1519
// authentication requests to the appropriate strategy based on the strategy name.
16-
// It uses sync.RWMutex for thread-safety as HTTP servers are inherently concurrent.
1720
//
1821
// Example usage:
1922
//

0 commit comments

Comments
 (0)