mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-27 22:21:18 +02:00
Merge pull request #6185 from sangaman/rpc-middleware-custom-caveat
rpcperms: set CustomCaveatCondition on middleware req
This commit is contained in:
@@ -910,7 +910,7 @@ func (r *InterceptorChain) middlewareRegistered() bool {
|
||||
|
||||
// acceptRequest sends an intercept request to all middlewares that have
|
||||
// registered for it. This means either a middleware has requested read-only
|
||||
// access or the request actually has a macaroon which a caveat the middleware
|
||||
// access or the request actually has a macaroon with a caveat the middleware
|
||||
// registered for.
|
||||
func (r *InterceptorChain) acceptRequest(requestID uint64,
|
||||
msg *InterceptionRequest) error {
|
||||
@@ -929,6 +929,10 @@ func (r *InterceptorChain) acceptRequest(requestID uint64,
|
||||
continue
|
||||
}
|
||||
|
||||
msg.CustomCaveatCondition = macaroons.GetCustomCaveatCondition(
|
||||
msg.Macaroon, middleware.customCaveatName,
|
||||
)
|
||||
|
||||
resp, err := middleware.intercept(requestID, msg)
|
||||
|
||||
// Error during interception itself.
|
||||
@@ -975,6 +979,10 @@ func (r *InterceptorChain) interceptResponse(ctx context.Context,
|
||||
continue
|
||||
}
|
||||
|
||||
msg.CustomCaveatCondition = macaroons.GetCustomCaveatCondition(
|
||||
msg.Macaroon, middleware.customCaveatName,
|
||||
)
|
||||
|
||||
resp, err := middleware.intercept(requestID, msg)
|
||||
|
||||
// Error during interception itself.
|
||||
|
Reference in New Issue
Block a user