Skip to content

Commit d1a1668

Browse files
committed
more CR suggestions
1 parent ad88344 commit d1a1668

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

middleware_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ func TestProjectVerifier(t *testing.T) {
402402
projectID := uint64(7)
403403

404404
authStore[projectID] = authcontrol.StaticAuth{
405-
Algorythm: authcontrol.DefaultAlgorithm,
405+
Algorithm: authcontrol.DefaultAlgorithm,
406406
Private: []byte(JWTSecret),
407407
}
408408

@@ -427,7 +427,7 @@ func TestProjectVerifier(t *testing.T) {
427427
})
428428

429429
authStore[projectID] = authcontrol.StaticAuth{
430-
Algorythm: "RS256",
430+
Algorithm: "RS256",
431431
Public: public,
432432
}
433433

s2s_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
func TestS2SToken(t *testing.T) {
1414
token := authcontrol.S2SToken(JWTSecret, map[string]any{"service": "test"})
1515

16-
auth := jwtauth.New(authcontrol.DefaultAlgorithm, []byte(JWTSecret), nil)
16+
auth := jwtauth.New(string(authcontrol.DefaultAlgorithm), []byte(JWTSecret), nil)
1717

1818
jwt, err := jwtauth.VerifyToken(auth, token)
1919
require.NoError(t, err)

verifier.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,24 @@ type AuthProvider interface {
2222

2323
// NewAuth creates a new AuthProvider with a static secret
2424
func NewAuth(secret string) AuthProvider {
25-
return StaticAuth{Algorythm: DefaultAlgorithm, Private: []byte(secret)}
25+
return StaticAuth{Algorithm: DefaultAlgorithm, Private: []byte(secret)}
2626
}
2727

2828
// StaticAuth is an AuthProvider with a static configuration
2929
type StaticAuth struct {
30-
Algorythm jwa.SignatureAlgorithm
30+
Algorithm jwa.SignatureAlgorithm
3131
Private []byte
3232
Public []byte
3333
}
3434

3535
// GetJWTAuth returns a JWTAuth using the private secret when available, otherwise the public key
3636
func (s StaticAuth) GetJWTAuth(_ *http.Request, options ...jwt.ValidateOption) (*jwtauth.JWTAuth, error) {
37-
if s.Algorythm == "" {
37+
if s.Algorithm == "" {
3838
return nil, fmt.Errorf("missing algorithm")
3939
}
4040

4141
if s.Private != nil {
42-
return jwtauth.New(s.Algorythm, s.Private, s.Private, options...), nil
42+
return jwtauth.New(string(s.Algorithm), s.Private, s.Private, options...), nil
4343
}
4444

4545
if s.Public == nil {
@@ -52,7 +52,7 @@ func (s StaticAuth) GetJWTAuth(_ *http.Request, options ...jwt.ValidateOption) (
5252
return nil, fmt.Errorf("parse public key: %w", err)
5353
}
5454

55-
return jwtauth.New(s.Algorythm, nil, pub, options...), nil
55+
return jwtauth.New(string(s.Algorithm), nil, pub, options...), nil
5656
}
5757

5858
// AuthStore is an interface for getting a StaticAuth by project ID

0 commit comments

Comments
 (0)