Add defaults
This commit is contained in:
parent
183c8bfb81
commit
91b9c3f92e
@ -7,11 +7,19 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/micro/go-micro/v2/api/resolver"
|
"github.com/micro/go-micro/v2/api/resolver"
|
||||||
|
"github.com/micro/go-micro/v2/api/resolver/path"
|
||||||
"github.com/micro/go-micro/v2/auth"
|
"github.com/micro/go-micro/v2/auth"
|
||||||
)
|
)
|
||||||
|
|
||||||
// CombinedAuthHandler wraps a server and authenticates requests
|
// CombinedAuthHandler wraps a server and authenticates requests
|
||||||
func CombinedAuthHandler(namespace string, r resolver.Resolver, h http.Handler) http.Handler {
|
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{
|
return authHandler{
|
||||||
handler: h,
|
handler: h,
|
||||||
resolver: r,
|
resolver: r,
|
||||||
|
Loading…
Reference in New Issue
Block a user