Files
tasks/common/authorization/token_key_provider.go
Stephan BehnkeandGitHub c9e360a3fb go fix (#9337)
## What changed?

Integrate Go 1.26's new `go fix` into workflow.

NOTE that the changes caused our linter to fire; a [separate
commit](https://github.com/temporalio/temporal/pull/9337/commits/1b23f787aef370098b35829c4d17dcc06230b4c1)
addresses those.

## Why?

Ensure Go code is standardized/modernized.

## How did you test it?
- [ ] built
- [ ] run locally and tested manually
- [x] covered by existing tests
- [ ] added new unit test(s)
- [ ] added new functional test(s)
2026-02-18 09:12:19 -08:00

29 lines
707 B
Go

package authorization
import (
"context"
"crypto/ecdsa"
"crypto/rsa"
"github.com/golang-jwt/jwt/v4"
)
// @@@SNIPSTART temporal-common-authorization-tokenkeyprovider-interface
// Provides keys for validating JWT tokens
type TokenKeyProvider interface {
EcdsaKey(alg string, kid string) (*ecdsa.PublicKey, error)
HmacKey(alg string, kid string) ([]byte, error)
RsaKey(alg string, kid string) (*rsa.PublicKey, error)
SupportedMethods() []string
Close()
}
// RawTokenKeyProvider is a TokenKeyProvider that provides keys for validating JWT tokens
type RawTokenKeyProvider interface {
GetKey(ctx context.Context, token *jwt.Token) (any, error)
SupportedMethods() []string
Close()
}
// @@@SNIPEND