Skip to content

Commit

Permalink
Merge pull request #33 from Comcast/feature/support_basic_auth
Browse files Browse the repository at this point in the history
Added basic auth support using the strings in the authHeader configur…
  • Loading branch information
schmidtw authored Jul 28, 2017
2 parents 40a3cab + 25f7302 commit 5b3675a
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/caduceus/caduceus.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ package main
import (
"crypto/tls"
"fmt"
"net/http"
"net/url"
"os"
"os/signal"
"time"

"github.com/Comcast/webpa-common/concurrent"
"github.com/Comcast/webpa-common/secure"
"github.com/Comcast/webpa-common/secure/handler"
Expand All @@ -14,11 +20,6 @@ import (
"github.com/justinas/alice"
"github.com/spf13/pflag"
"github.com/spf13/viper"
"net/http"
"net/url"
"os"
"os/signal"
"time"
)

const (
Expand Down Expand Up @@ -61,6 +62,15 @@ func getValidator(v *viper.Viper) (validator secure.Validator, err error) {
)
}

// TODO: This should really be part of the unmarshalled validators somehow
basicAuth := v.GetStringSlice("authHeader")
for _, authValue := range basicAuth {
validators = append(
validators,
secure.ExactMatchValidator(authValue),
)
}

validator = validators

return
Expand Down

0 comments on commit 5b3675a

Please sign in to comment.