Add defaults

This commit is contained in:
Ben Toogood 2020-04-03 10:08:39 +01:00
parent 183c8bfb81
commit 91b9c3f92e

View File

@ -7,11 +7,19 @@ import (
"strings"
"github.com/micro/go-micro/v2/api/resolver"
"github.com/micro/go-micro/v2/api/resolver/path"
"github.com/micro/go-micro/v2/auth"
)
// CombinedAuthHandler wraps a server and authenticates requests
func CombinedAuthHandler(namespace string, r resolver.Resolver, h http.Handler) http.Handler {
if r == nil {
r = path.NewResolver()
}
if len(namespace) == 0 {
namespace = "go.micro"
}
return authHandler{
handler: h,
resolver: r,