Fix reading auth headers
This commit is contained in:
parent
77bc243110
commit
c7b2bf8100
@ -4,12 +4,19 @@ import (
|
|||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-lotus/api"
|
"github.com/filecoin-project/go-lotus/api"
|
||||||
|
"github.com/filecoin-project/go-lotus/lib/auth"
|
||||||
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
|
"github.com/filecoin-project/go-lotus/lib/jsonrpc"
|
||||||
)
|
)
|
||||||
|
|
||||||
func serveRPC(a api.FullNode, addr string) error {
|
func serveRPC(a api.FullNode, addr string) error {
|
||||||
rpcServer := jsonrpc.NewServer()
|
rpcServer := jsonrpc.NewServer()
|
||||||
rpcServer.Register("Filecoin", api.PermissionedFullAPI(a))
|
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)
|
return http.ListenAndServe(addr, http.DefaultServeMux)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user