Skip to content

Commit

Permalink
cleanup metadata (#3103)
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardsn authored May 13, 2024
1 parent 7247c60 commit 7bbddbc
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions auth/api/iam/metadata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Test_authorizationServerMetadata(t *testing.T) {
PresentationDefinitionUriSupported: &presentationDefinitionURISupported,
PresentationDefinitionEndpoint: oauth2Base.String() + "/presentation_definition",
RequireSignedRequestObject: true,
ResponseTypesSupported: []string{"code", "vp_token", "vp_token id_token"},
ResponseTypesSupported: []string{"code", "vp_token"},
ResponseModesSupported: []string{"query", "direct_post"},
TokenEndpoint: oauth2Base.String() + "/token",
VPFormats: oauth.DefaultOpenIDSupportedFormats(),
Expand All @@ -59,7 +59,7 @@ func Test_clientMetadata(t *testing.T) {
RedirectURIs: nil,
TokenEndpointAuthMethod: "none",
GrantTypes: []string{"authorization_code", "vp_token", "urn:ietf:params:oauth:grant-type:pre-authorized_code"},
ResponseTypes: []string{"code", "vp_token", "vp_token id_token"},
ResponseTypes: []string{"code", "vp_token"},
Scope: "",
Contacts: nil,
JwksURI: "",
Expand Down
8 changes: 3 additions & 5 deletions auth/api/iam/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
package iam

import (
"net/http"

"github.com/nuts-foundation/go-did/did"
"github.com/nuts-foundation/go-did/vc"
"github.com/nuts-foundation/nuts-node/auth/oauth"
"github.com/nuts-foundation/nuts-node/vcr/pe"
"github.com/nuts-foundation/nuts-node/vdr/resolver"
"net/http"
)

// DIDDocument is an alias
Expand Down Expand Up @@ -91,12 +92,9 @@ const (
// responseTypeVPToken is defined in the OpenID4VP vp_token flow
// https://openid.bitbucket.io/connect/openid-4-verifiable-presentations-1_0.html#appendix-B
responseTypeVPToken = "vp_token"
// responseTypeVPIDToken is defined in the OpenID4VP flow that combines its vp_token with SIOPv2's id_token
// https://openid.bitbucket.io/connect/openid-4-verifiable-presentations-1_0.html#appendix-B
responseTypeVPIDToken = "vp_token id_token"
)

var responseTypesSupported = []string{responseTypeCode, responseTypeVPToken, responseTypeVPIDToken}
var responseTypesSupported = []string{responseTypeCode, responseTypeVPToken}

const (
// responseModeParam is the name of the OAuth2 response_mode parameter.
Expand Down
9 changes: 5 additions & 4 deletions auth/oauth/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ package oauth

import (
"encoding/json"
"github.com/nuts-foundation/nuts-node/core"
"net/url"

"github.com/nuts-foundation/nuts-node/core"
)

// this file contains constants, variables and helper functions for OAuth related code
Expand Down Expand Up @@ -180,12 +181,12 @@ func IssuerIdToWellKnown(issuer string, wellKnown string, strictmode bool) (*url
// Specified by https://www.rfc-editor.org/rfc/rfc8414.txt
type AuthorizationServerMetadata struct {
// Issuer defines the authorization server's identifier, which is a URL that uses the "https" scheme and has no query or fragment components.
Issuer string `json:"issuer"`
Issuer string `json:"issuer,omitempty"`

/* ******** /authorize ******** */

// AuthorizationEndpoint defines the URL of the authorization server's authorization endpoint [RFC6749]
AuthorizationEndpoint string `json:"authorization_endpoint"`
AuthorizationEndpoint string `json:"authorization_endpoint,omitempty"`

// ResponseTypesSupported defines what response types a client can request
ResponseTypesSupported []string `json:"response_types_supported,omitempty"`
Expand All @@ -200,7 +201,7 @@ type AuthorizationServerMetadata struct {
/* ******** /token ******** */

// TokenEndpoint defines the URL of the authorization server's token endpoint [RFC6749].
TokenEndpoint string `json:"token_endpoint"`
TokenEndpoint string `json:"token_endpoint,omitempty"`

// GrantTypesSupported is a list of the OAuth 2.0 grant type values that this authorization server supports.
GrantTypesSupported []string `json:"grant_types_supported,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion crypto/jwx/algorithm.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ package jwx

import (
"errors"

"github.com/lestrrat-go/jwx/v2/jwa"
)

// ErrUnsupportedSigningKey is returned when an unsupported private key is used to sign. Currently only ecdsa and rsa keys are supported
var ErrUnsupportedSigningKey = errors.New("signing key algorithm not supported")

var SupportedAlgorithms = []jwa.SignatureAlgorithm{jwa.PS256, jwa.PS384, jwa.PS512, jwa.ES256, jwa.EdDSA, jwa.ES384, jwa.ES512}
var SupportedAlgorithms = []jwa.SignatureAlgorithm{jwa.ES256, jwa.EdDSA, jwa.ES384, jwa.ES512, jwa.PS256, jwa.PS384, jwa.PS512}

const DefaultRsaEncryptionAlgorithm = jwa.RSA_OAEP_256
const DefaultEcEncryptionAlgorithm = jwa.ECDH_ES_A256KW
Expand Down

0 comments on commit 7bbddbc

Please sign in to comment.