Skip to content

Commit

Permalink
explicitly support PresentationDefinitionUriSupported (#3093)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardsn authored May 7, 2024
1 parent a9ce5be commit 2dc73fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions auth/api/iam/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ import (
)

func authorizationServerMetadata(identity url.URL, oauth2BaseURL url.URL) oauth.AuthorizationServerMetadata {
presentationDefinitionURISupported := true
return oauth.AuthorizationServerMetadata{
AuthorizationEndpoint: oauth2BaseURL.JoinPath("authorize").String(),
ClientIdSchemesSupported: clientIdSchemesSupported,
DPoPSigningAlgValuesSupported: jwx.SupportedAlgorithmsAsStrings(),
GrantTypesSupported: grantTypesSupported,
Issuer: identity.String(),
PreAuthorizedGrantAnonymousAccessSupported: true,
PresentationDefinitionUriSupported: &presentationDefinitionURISupported,
PresentationDefinitionEndpoint: oauth2BaseURL.JoinPath("presentation_definition").String(),
RequireSignedRequestObject: true,
ResponseModesSupported: responseModesSupported,
Expand Down
7 changes: 5 additions & 2 deletions auth/api/iam/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,25 +19,28 @@
package iam

import (
"net/url"
"testing"

"github.com/nuts-foundation/nuts-node/auth/oauth"
"github.com/nuts-foundation/nuts-node/core"
"github.com/nuts-foundation/nuts-node/crypto/jwx"
"github.com/nuts-foundation/nuts-node/test"
"github.com/stretchr/testify/assert"
"net/url"
"testing"
)

func Test_authorizationServerMetadata(t *testing.T) {
identity := test.MustParseURL("https://example.com/iam/123")
oauth2Base := test.MustParseURL("https://example.com/oauth2/did:web:example.com:iam:123")
presentationDefinitionURISupported := true
expected := oauth.AuthorizationServerMetadata{
AuthorizationEndpoint: oauth2Base.String() + "/authorize",
ClientIdSchemesSupported: []string{"did"},
DPoPSigningAlgValuesSupported: jwx.SupportedAlgorithmsAsStrings(),
GrantTypesSupported: []string{"authorization_code", "vp_token", "urn:ietf:params:oauth:grant-type:pre-authorized_code"},
Issuer: identity.String(),
PreAuthorizedGrantAnonymousAccessSupported: true,
PresentationDefinitionUriSupported: &presentationDefinitionURISupported,
PresentationDefinitionEndpoint: oauth2Base.String() + "/presentation_definition",
RequireSignedRequestObject: true,
ResponseTypesSupported: []string{"code", "vp_token", "vp_token id_token"},
Expand Down

0 comments on commit 2dc73fb

Please sign in to comment.