Skip to content

Commit

Permalink
fix: remove proxyattr alias
Browse files Browse the repository at this point in the history
  • Loading branch information
FemiNoviaLina committed Jul 4, 2024
1 parent 14169e2 commit 2bf4cdf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/proxy/middleware/basic_auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"strings"
"text/template"

proxyattr "github.com/goto/shield/internal/proxy/attribute"
"github.com/goto/shield/internal/proxy/attribute"
"github.com/goto/shield/internal/proxy/middleware"
"github.com/goto/shield/pkg/body_extractor"
"github.com/goto/shield/pkg/httputil"
Expand Down Expand Up @@ -55,7 +55,7 @@ type Credentials struct {

type Scope struct {
Action string `yaml:"action" mapstructure:"action"`
Attributes map[string]proxyattr.Attribute `yaml:"attributes" mapstructure:"attributes"` // auth field -> Attribute
Attributes map[string]attribute.Attribute `yaml:"attributes" mapstructure:"attributes"` // auth field -> Attribute
}

func New(logger log.Logger, next http.Handler) *BasicAuth {
Expand Down Expand Up @@ -140,7 +140,7 @@ func (w BasicAuth) authorizeRequest(conf Config, user string, req *http.Request)
for res, attr := range conf.Scope.Attributes {
templateMap[res] = ""
switch attr.Type {
case proxyattr.TypeGRPCPayload:
case attribute.TypeGRPCPayload:
// check if grpc request
if !strings.HasPrefix(req.Header.Get("Content-Type"), "application/grpc") {
w.log.Error("middleware: not a valid grpc request")
Expand All @@ -156,7 +156,7 @@ func (w BasicAuth) authorizeRequest(conf Config, user string, req *http.Request)

templateMap[res] = payloadField
w.log.Debug("middleware: extracted", "field", payloadField, "attr", attr)
case proxyattr.TypeJSONPayload:
case attribute.TypeJSONPayload:
if attr.Key == "" {
w.log.Error("middleware: payload key field empty")
return false
Expand Down

0 comments on commit 2bf4cdf

Please sign in to comment.