Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mantas-sidlauskas committed Feb 14, 2024
1 parent 7162df9 commit d94b61c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 3 additions & 5 deletions internal/common/auth/service_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,15 @@ package auth

import (
"context"
"github.com/golang-jwt/jwt/v5"

"go.uber.org/yarpc"

"github.com/golang-jwt/jwt/v5"
"go.uber.org/cadence/.gen/go/cadence/workflowserviceclient"
"go.uber.org/cadence/.gen/go/shared"
"go.uber.org/yarpc"
)

const (
jwtHeaderName = "cadence-authorization"
JWTInternalIssuer = "internal-jwt"
jwtHeaderName = "cadence-authorization"
)

type workflowServiceAuthWrapper struct {
Expand Down
4 changes: 3 additions & 1 deletion internal/jwt_authorization.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import (
"go.uber.org/cadence/internal/common/util"
)

const internalIssuer = "internal-jwt"

type JWTAuthProvider struct {
PrivateKey []byte
}
Expand All @@ -48,7 +50,7 @@ func (j *JWTAuthProvider) GetAuthToken() ([]byte, error) {
ttl := int64(60 * 10)
claims := auth.JWTClaims{
RegisteredClaims: jwt.RegisteredClaims{
Issuer: auth.JWTInternalIssuer,
Issuer: internalIssuer,
IssuedAt: jwt.NewNumericDate(time.Now()),
ExpiresAt: jwt.NewNumericDate(time.Now().Add(time.Second * time.Duration(ttl))),
},
Expand Down
2 changes: 1 addition & 1 deletion internal/jwt_authorization_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
package internal

import (
"github.com/stretchr/testify/assert"
"os"
"testing"

"github.com/golang-jwt/jwt/v5"
"github.com/stretchr/testify/assert"
"go.uber.org/cadence/internal/common/auth"
"go.uber.org/cadence/internal/common/util"
)
Expand Down

0 comments on commit d94b61c

Please sign in to comment.