Skip to content

Commit 44f9a3d

Browse files
committed
[tunnel/token] Add TokenIssuer interface
1 parent a4997cc commit 44f9a3d

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

pkg/apiserver/controllers/tunnelnode.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type TunnelNodeReconciler struct {
3636
ipamv6, ipamv4 tunnet.IPAM
3737

3838
validator *token.InMemoryValidator
39-
issuer *token.Issuer
39+
issuer token.TokenIssuer
4040
}
4141

4242
func NewTunnelNodeReconciler(

pkg/tunnel/token/issuer.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ import (
1010
"github.com/golang-jwt/jwt/v5"
1111
)
1212

13+
// TokenIssuer is an interface for issuing JWT tokens.
14+
type TokenIssuer interface {
15+
IssueToken(subject string, ttl time.Duration) (string, jwt.Claims, error)
16+
}
17+
18+
// Issuer implements TokenIssuer for issuing JWT tokens.
1319
type Issuer struct {
1420
privateKey *ecdsa.PrivateKey
1521
kid string

0 commit comments

Comments
 (0)