Fix reading auth headers

This commit is contained in:
Łukasz Magiera 2019-07-24 15:40:42 +02:00
parent 77bc243110
commit c7b2bf8100

View File

@ -4,12 +4,19 @@ import (
"net/http"
"github.com/filecoin-project/go-lotus/api"
"github.com/filecoin-project/go-lotus/lib/auth"
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
)
func serveRPC(a api.FullNode, addr string) error {
rpcServer := jsonrpc.NewServer()
rpcServer.Register("Filecoin", api.PermissionedFullAPI(a))
http.Handle("/rpc/v0", rpcServer)
ah := &auth.Handler{
Verify: a.AuthVerify,
Next: rpcServer.ServeHTTP,
}
http.Handle("/rpc/v0", ah)
return http.ListenAndServe(addr, http.DefaultServeMux)
}