@@ -22,19 +22,21 @@ import (
22
22
"context"
23
23
"errors"
24
24
"fmt"
25
- "github.com/nuts-foundation/nuts-node/http/client"
26
25
"net"
27
26
"net/http"
28
27
"os"
28
+ "slices"
29
29
"strings"
30
30
"time"
31
31
32
32
"github.com/labstack/echo/v4"
33
33
"github.com/labstack/echo/v4/middleware"
34
34
"github.com/nuts-foundation/nuts-node/core"
35
35
cryptoEngine "github.com/nuts-foundation/nuts-node/crypto"
36
+ "github.com/nuts-foundation/nuts-node/http/client"
36
37
"github.com/nuts-foundation/nuts-node/http/log"
37
38
"github.com/nuts-foundation/nuts-node/http/tokenV2"
39
+ "github.com/nuts-foundation/nuts-node/vdr/didnuts"
38
40
)
39
41
40
42
const moduleName = "HTTP"
@@ -180,15 +182,19 @@ func matchesPath(requestURI string, path string) bool {
180
182
}
181
183
182
184
func (h Engine ) applyRateLimiterMiddleware (echoServer core.EchoRouter , serverConfig core.ServerConfig ) {
183
- // Always enabled in strict mode
184
- if serverConfig .Strictmode || serverConfig .InternalRateLimiter {
185
+ // Always enabled in strict mode, but only if did:nuts is enabled on the node
186
+ if ( serverConfig .Strictmode || serverConfig .InternalRateLimiter ) && slices . Contains ( serverConfig . DIDMethods , didnuts . MethodName ) {
185
187
echoServer .Use (newInternalRateLimiter (map [string ][]string {
186
188
http .MethodPost : {
187
- "/internal/vcr/v2/issuer/vc" , // issuing new VCs
188
- "/internal/vdr/v1/did" , // creating new DIDs
189
- "/internal/vdr/v1/did/:did/verificationmethod" , // add VM to DID
190
- "/internal/didman/v1/did/:did/endpoint" , // add endpoint to DID
191
- "/internal/didman/v1/did/:did/compoundservice" , // add compound service to DID
189
+ "/internal/vcr/v2/issuer/vc" , // issuing new VCs
190
+ "/internal/vdr/v1/did" , // creating new DIDs
191
+ "/internal/vdr/v1/did/:did/verificationmethod" , // add VM to DID
192
+ "/internal/didman/v1/did/:did/endpoint" , // add endpoint to DID
193
+ "/internal/didman/v1/did/:did/compoundservice" , // add compound service to DID
194
+ "/internal/vdr/v2/subject" , // create new subject
195
+ "/internal/vdr/v2/subject/:id/service" , // add service to subject
196
+ "/internal/vdr/v2/subject/:id/service/:serviceId" , // update service for a subject
197
+ "/internal/vdr/v2/subject/:id/verificationmethod" , // create new verification method for subject
192
198
},
193
199
http .MethodPut : {
194
200
"/internal/vdr/v1/did/:did" , // updating DIDs
0 commit comments