Files
tasks/common/rpc/auth/token_provider.go
stuart-wellsandGitHub 28fb98c825 Adding JWT auth capability for s2s replication (#10165)
## What changed?
Adds JWT to server-to-server connections. Frontend already had support
for reading auth so this focuses on getting a token and injecting it.

## Why?
s2s is currently a gap in the auth abilities. This provides more
flexibility for users based on their auth requirements.

## How did you test it?
- [x] built
- [x] run locally and tested manually
- [x] covered by existing tests
- [x] added new unit test(s)
- [x] added new functional test(s)

## Potential risks
Need to get auth right. Main risk is a user believing they are secure
when they are not.
2026-05-27 11:00:51 -07:00

16 lines
546 B
Go

package auth
import (
"context"
)
// TokenProvider supplies auth tokens for outbound remote-cluster RPCs.
// rpcAddress is the receiver's host:port. Implementations are responsible for
// their own caching: GetToken is called on every outbound RPC, so a provider
// that incurs IdP round-trips must cache internally. A nil TokenProvider means
// no auth header is sent; downstream consumers (RPCFactory) handle this case
// directly.
type TokenProvider interface {
GetToken(ctx context.Context, rpcAddress string) (token string, err error)
}