Skip to content

Commit

Permalink
chore: rename a field in the auto authenticator
Browse files Browse the repository at this point in the history
  • Loading branch information
1995parham committed Dec 4, 2023
1 parent 75abd6b commit 0dc61ff
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions internal/authenticator/auto_authenticator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type AutoAuthenticator struct {
AllowedAccessTypes []acl.AccessType
TopicManager *topics.Manager
Company string
JwtConfig config.JWT
JWTConfig config.JWT
Validator validator.Client
Parser *jwt.Parser
}
Expand Down Expand Up @@ -56,17 +56,17 @@ func (a AutoAuthenticator) ACL(
return false, ErrInvalidClaims
}

if claims[a.JwtConfig.IssName] == nil {
if claims[a.JWTConfig.IssName] == nil {
return false, ErrIssNotFound
}

issuer := fmt.Sprintf("%v", claims[a.JwtConfig.IssName])
issuer := fmt.Sprintf("%v", claims[a.JWTConfig.IssName])

if claims[a.JwtConfig.SubName] == nil {
if claims[a.JWTConfig.SubName] == nil {
return false, ErrSubNotFound
}

sub, _ := claims[a.JwtConfig.SubName].(string)
sub, _ := claims[a.JWTConfig.SubName].(string)

topicTemplate := a.TopicManager.ParseTopic(topic, issuer, sub)
if topicTemplate == nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/authenticator/auto_authenticator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (suite *AutoAuthenticatorTestSuite) SetupSuite() {
Company: "snapp",
Parser: jwt.NewParser(),
TopicManager: topics.NewTopicManager(cfg.Topics, hid, "snapp", cfg.IssEntityMap, cfg.IssPeerMap, zap.NewNop()),
JwtConfig: config.JWT{
JWTConfig: config.JWT{
IssName: "iss",
SubName: "sub",
SigningMethod: "rsa256",
Expand Down
2 changes: 1 addition & 1 deletion internal/authenticator/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (b Builder) autoAuthenticator(vendor config.Vendor) (*AutoAuthenticator, er
vendor.IssPeerMap,
b.Logger.Named("topic-manager"),
),
JwtConfig: vendor.Jwt,
JWTConfig: vendor.Jwt,
Validator: client,
Parser: jwt.NewParser(),
}, nil
Expand Down

0 comments on commit 0dc61ff

Please sign in to comment.