Files
tasks/common/rpc/auth/authtest/static.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

22 lines
698 B
Go

// Package authtest provides shared test helpers for the auth package. The conventional
// "*test" suffix marks it as test-shaped, but it is a regular Go package importable from
// production code (e.g. manual harnesses) when needed.
package authtest
import (
"context"
"go.temporal.io/server/common/rpc/auth"
)
// StaticTokenProvider returns the same token for every call. Useful for manual
// harnesses and tests; not a production-grade provider (no expiry, no rotation,
// no per-receiver scoping).
type StaticTokenProvider string
var _ auth.TokenProvider = StaticTokenProvider("")
func (t StaticTokenProvider) GetToken(context.Context, string) (string, error) {
return string(t), nil
}