mirror of
https://github.com/lightninglabs/lightning-terminal.git
synced 2026-08-13 12:33:36 +02:00
subservers: add WhiteListedURLs to the SubServer interface
Add a new `WhiteListedURLs` method to the `SubServer` interface so that Lit can easily collect the set of permissions from each sub-server that does not require a macaroon.
This commit is contained in:
parent
84df1bf966
commit
1332106eef
5 changed files with 44 additions and 0 deletions
|
|
@ -118,3 +118,11 @@ func (f *faradaySubServer) MacPath() string {
|
|||
func (f *faradaySubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
// accessed without a macaroon.
|
||||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (f *faradaySubServer) WhiteListedURLs() map[string]struct{} {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,4 +58,8 @@ type SubServer interface {
|
|||
// Permissions returns a map of all RPC methods and their required
|
||||
// macaroon permissions to access the sub-server.
|
||||
Permissions() map[string][]bakery.Op
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can
|
||||
// be accessed without a macaroon.
|
||||
WhiteListedURLs() map[string]struct{}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,3 +128,11 @@ func (l *loopSubServer) MacPath() string {
|
|||
func (l *loopSubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
// accessed without a macaroon.
|
||||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (l *loopSubServer) WhiteListedURLs() map[string]struct{} {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,3 +118,11 @@ func (p *poolSubServer) MacPath() string {
|
|||
func (p *poolSubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
// accessed without a macaroon.
|
||||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (p *poolSubServer) WhiteListedURLs() map[string]struct{} {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,3 +174,19 @@ func (t *taprootAssetsSubServer) MacPath() string {
|
|||
func (t *taprootAssetsSubServer) Permissions() map[string][]bakery.Op {
|
||||
return perms.RequiredPermissions
|
||||
}
|
||||
|
||||
// WhiteListedURLs returns a map of all the sub-server's URLs that can be
|
||||
// accessed without a macaroon.
|
||||
//
|
||||
// NOTE: this is part of the SubServer interface.
|
||||
func (t *taprootAssetsSubServer) WhiteListedURLs() map[string]struct{} {
|
||||
// If the taproot-asset daemon is running in integrated mode, then we
|
||||
// use cfg.RpcConf.AllowPublicStats to determine if the public stats
|
||||
// endpoints should be included in the whitelist. If it is running in
|
||||
// remote mode, however, then we don't know if the public stats are
|
||||
// allowed, and so we just allow the request through since the remote
|
||||
// daemon will handle blocking the call if it is not whitelisted there.
|
||||
return perms.MacaroonWhitelist(
|
||||
t.cfg.RpcConf.AllowPublicStats || t.remote,
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue