From 3b47e20b88dda825bbd8897bf4ceb27ecabda333 Mon Sep 17 00:00:00 2001 From: Wout Slakhorst Date: Tue, 12 Dec 2023 10:27:25 +0100 Subject: [PATCH] fix wrong refactor --- auth/services/oauth/verifier.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/auth/services/oauth/verifier.go b/auth/services/oauth/verifier.go index c5fbaf65dc..cf9d029fdb 100644 --- a/auth/services/oauth/verifier.go +++ b/auth/services/oauth/verifier.go @@ -20,8 +20,10 @@ package oauth import ( + "context" "crypto/tls" "fmt" + "github.com/nuts-foundation/nuts-node/auth/client/iam" "github.com/nuts-foundation/nuts-node/vdr/didweb" "net/url" "time" @@ -47,6 +49,16 @@ func NewVerifier(strictMode bool, httpClientTimeout time.Duration, httpClientTLS } } +func (v *VerifierServiceProvider) AuthorizationServerMetadata(ctx context.Context, webdid did.DID) (*oauth.AuthorizationServerMetadata, error) { + iamClient := iam.NewHTTPClient(v.strictMode, v.httpClientTimeout, v.httpClientTLS) + // the wallet/holder acts as authorization server + metadata, err := iamClient.OAuthAuthorizationServerMetadata(ctx, webdid) + if err != nil { + return nil, fmt.Errorf("failed to retrieve remote OAuth Authorization Server metadata: %w", err) + } + return metadata, nil +} + func (v *VerifierServiceProvider) ClientMetadataURL(webdid did.DID) (*url.URL, error) { didURL, err := didweb.DIDToURL(webdid) if err != nil {