@@ -23,10 +23,16 @@ import (
23
23
"errors"
24
24
"github.com/nuts-foundation/nuts-node/auth/client/iam"
25
25
"github.com/nuts-foundation/nuts-node/vdr"
26
+ "github.com/nuts-foundation/nuts-node/vdr/didjwk"
27
+ "github.com/nuts-foundation/nuts-node/vdr/didkey"
28
+ "github.com/nuts-foundation/nuts-node/vdr/didnuts"
26
29
"github.com/nuts-foundation/nuts-node/vdr/didsubject"
30
+ "github.com/nuts-foundation/nuts-node/vdr/didweb"
31
+ "github.com/nuts-foundation/nuts-node/vdr/didx509"
27
32
"github.com/nuts-foundation/nuts-node/vdr/resolver"
28
33
"net/url"
29
34
"path"
35
+ "slices"
30
36
"time"
31
37
32
38
"github.com/nuts-foundation/nuts-node/auth/services"
@@ -46,23 +52,25 @@ var _ AuthenticationServices = (*Auth)(nil)
46
52
47
53
// Auth is the main struct of the Auth service
48
54
type Auth struct {
49
- config Config
50
- jsonldManager jsonld.JSONLD
51
- authzServer oauth.AuthorizationServer
52
- relyingParty oauth.RelyingParty
53
- contractNotary services.ContractNotary
54
- serviceResolver didman.CompoundServiceResolver
55
- keyStore crypto.KeyStore
56
- vcr vcr.VCR
57
- pkiProvider pki.Provider
58
- shutdownFunc func ()
59
- vdrInstance vdr.VDR
60
- publicURL * url.URL
61
- strictMode bool
62
- httpClientTimeout time.Duration
63
- tlsConfig * tls.Config
64
- subjectManager didsubject.Manager
65
- supportedDIDMethods []string
55
+ config Config
56
+ jsonldManager jsonld.JSONLD
57
+ authzServer oauth.AuthorizationServer
58
+ relyingParty oauth.RelyingParty
59
+ contractNotary services.ContractNotary
60
+ serviceResolver didman.CompoundServiceResolver
61
+ keyStore crypto.KeyStore
62
+ vcr vcr.VCR
63
+ pkiProvider pki.Provider
64
+ shutdownFunc func ()
65
+ vdrInstance vdr.VDR
66
+ publicURL * url.URL
67
+ strictMode bool
68
+ httpClientTimeout time.Duration
69
+ tlsConfig * tls.Config
70
+ subjectManager didsubject.Manager
71
+ // configuredDIDMethods contains the DID methods that are configured in the Nuts node,
72
+ // of which VDR will create DIDs.
73
+ configuredDIDMethods []string
66
74
}
67
75
68
76
// Name returns the name of the module.
@@ -137,7 +145,7 @@ func (auth *Auth) Configure(config core.ServerConfig) error {
137
145
return err
138
146
}
139
147
140
- auth .supportedDIDMethods = config .DIDMethods
148
+ auth .configuredDIDMethods = config .DIDMethods
141
149
142
150
auth .contractNotary = notary .NewNotary (notary.Config {
143
151
PublicURL : auth .publicURL .String (),
@@ -179,7 +187,13 @@ func (auth *Auth) Configure(config core.ServerConfig) error {
179
187
}
180
188
181
189
func (auth * Auth ) SupportedDIDMethods () []string {
182
- return append (auth .supportedDIDMethods , "x509" )
190
+ // DID methods that don't require additional resources/configuration in the Nuts node are always supported.
191
+ // Other DID methods (did:nuts), are only supported if explicitly enabled.
192
+ result := []string {didweb .MethodName , didjwk .MethodName , didkey .MethodName , didx509 .MethodName }
193
+ if slices .Contains (auth .configuredDIDMethods , didnuts .MethodName ) {
194
+ result = append (result , didnuts .MethodName )
195
+ }
196
+ return result
183
197
}
184
198
185
199
// Start starts the Auth engine (Noop)
0 commit comments