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.
22 lines
698 B
Go
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
|
|
}
|