Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

copy default parameters to prevent concurrent map write #74

Merged
merged 1 commit into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion auth/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

"github.com/dgrijalva/jwt-go"
"github.com/gomodule/redigo/redis"
"github.com/jinzhu/copier"
"github.com/mittwald/servicegateway/config"
"github.com/op/go-logging"
cache "github.com/patrickmn/go-cache"
Expand Down Expand Up @@ -106,7 +107,11 @@ func NewAuthenticationHandler(
func (h *AuthenticationHandler) Authenticate(username string, password string, additionalBodyProperties map[string]interface{}) (*JWTResponse, error) {
response := JWTResponse{}

authRequest := h.config.ProviderConfig.Parameters
authRequest := make(map[string]interface{})
err := copier.Copy(&authRequest, h.config.ProviderConfig.Parameters)
if err != nil {
return nil, fmt.Errorf("failed to copy default parameters!")
}
authRequest["username"] = username
authRequest["password"] = password

Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ require (
github.com/gorilla/handlers v1.5.2
github.com/hashicorp/consul/api v1.26.1
github.com/hashicorp/golang-lru v1.0.2
github.com/jinzhu/copier v0.4.0
github.com/julienschmidt/httprouter v1.3.0
github.com/op/go-logging v0.0.0-20160315200505-970db520ece7
github.com/patrickmn/go-cache v2.1.0+incompatible
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR
github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0=
github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY=
github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4=
github.com/jinzhu/copier v0.4.0 h1:w3ciUoD19shMCRargcpm0cm91ytaBhDvuRpz1ODO/U8=
github.com/jinzhu/copier v0.4.0/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
Expand Down
Loading