Skip to content

Commit

Permalink
Rename functions to clarify purpose
Browse files Browse the repository at this point in the history
  • Loading branch information
lmsilva-wls committed May 25, 2021
1 parent 3df8de2 commit 1d4f33d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ func IsAuthorized(ctx context.Context, app *App, userID string, topics ...string
httpAuthEnabled := app.Config.GetBool("httpAuth.enabled")

if httpAuthEnabled {
return httpAuthenticate(app, userID, topics)
return httpAuthorize(app, userID, topics)
}

return mongoAuthenticate(ctx, userID, topics)
return mongoAuthorize(ctx, userID, topics)
}

func httpAuthenticate(app *App, userID string, topics []string) (bool, []string, error) {
func httpAuthorize(app *App, userID string, topics []string) (bool, []string, error) {
timeout := app.Config.GetDuration("httpAuth.timeout") * time.Second
address := app.Config.GetString("httpAuth.requestURL")

Expand Down Expand Up @@ -139,7 +139,7 @@ func httpAuthenticate(app *App, userID string, topics []string) (bool, []string,
return isAuthorized, allowedTopics, nil
}

func mongoAuthenticate(ctx context.Context, userID string, topics []string) (bool, []string, error) {
func mongoAuthorize(ctx context.Context, userID string, topics []string) (bool, []string, error) {
for _, topic := range topics {
pieces := strings.Split(topic, "/")
pieces[len(pieces)-1] = "+"
Expand Down

0 comments on commit 1d4f33d

Please sign in to comment.