mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
## 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.
16 lines
546 B
Go
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)
|
|
}
|