mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
multi: add MacaroonPath method to subserver manager
This commit is contained in:
parent
0ab5cb750b
commit
9eb01518e6
2 changed files with 30 additions and 34 deletions
43
rpc_proxy.go
43
rpc_proxy.go
|
|
@ -467,46 +467,21 @@ func (p *rpcProxy) basicAuthToMacaroon(basicAuth, requestURI string,
|
|||
return nil, ctxErr
|
||||
}
|
||||
|
||||
var (
|
||||
macPath string
|
||||
macData []byte
|
||||
)
|
||||
subserver, err := p.permsMgr.SubServerHandler(requestURI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var macData []byte
|
||||
handled, macPath := p.subServerMgr.MacaroonPath(requestURI)
|
||||
|
||||
switch subserver {
|
||||
case subservers.LND:
|
||||
switch {
|
||||
case handled:
|
||||
|
||||
case p.permsMgr.IsSubServerURI(subservers.LND, requestURI):
|
||||
_, _, _, macPath, macData = p.cfg.lndConnectParams()
|
||||
|
||||
case subservers.FARADAY:
|
||||
if p.cfg.faradayRemote {
|
||||
macPath = p.cfg.Remote.Faraday.MacaroonPath
|
||||
} else {
|
||||
macPath = p.cfg.Faraday.MacaroonPath
|
||||
}
|
||||
|
||||
case subservers.LOOP:
|
||||
if p.cfg.loopRemote {
|
||||
macPath = p.cfg.Remote.Loop.MacaroonPath
|
||||
} else {
|
||||
macPath = p.cfg.Loop.MacaroonPath
|
||||
}
|
||||
|
||||
case subservers.POOL:
|
||||
if p.cfg.poolRemote {
|
||||
macPath = p.cfg.Remote.Pool.MacaroonPath
|
||||
} else {
|
||||
macPath = p.cfg.Pool.MacaroonPath
|
||||
}
|
||||
|
||||
case subservers.LIT:
|
||||
case p.permsMgr.IsSubServerURI(subservers.LIT, requestURI):
|
||||
macPath = p.cfg.MacaroonPath
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("unknown subserver handler: %v",
|
||||
subserver)
|
||||
return nil, fmt.Errorf("unknown gRPC web request: %v",
|
||||
requestURI)
|
||||
}
|
||||
|
||||
switch {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue