Skip to content

Commit

Permalink
fixes after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
woutslakhorst committed Dec 5, 2023
1 parent 4127a77 commit d72e374
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 43 deletions.
3 changes: 0 additions & 3 deletions auth/api/iam/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,8 @@ import (
"github.com/nuts-foundation/nuts-node/auth/oauth"
oauthServices "github.com/nuts-foundation/nuts-node/auth/services/oauth"
"github.com/nuts-foundation/nuts-node/core"
<<<<<<< HEAD
"github.com/nuts-foundation/nuts-node/jsonld"
=======
"github.com/nuts-foundation/nuts-node/policy"
>>>>>>> af230925 (WIP, changing old PE store impl to use new backend and make sure tests run....)
"github.com/nuts-foundation/nuts-node/storage"
"github.com/nuts-foundation/nuts-node/vcr/pe"
"github.com/nuts-foundation/nuts-node/vdr"
Expand Down
1 change: 0 additions & 1 deletion auth/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package auth

import (
"errors"
"fmt"
"github.com/nuts-foundation/nuts-node/vdr"
"github.com/nuts-foundation/nuts-node/vdr/resolver"
"net/url"
Expand Down
2 changes: 0 additions & 2 deletions auth/cmd/cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@ func TestFlagSet(t *testing.T) {
ConfHTTPTimeout,
ConfAutoUpdateIrmaSchemas,
ConfIrmaSchemeManager,
ConfPresentationExchangeMappingFile,
ConfPublicURL,
ConfV2APIEnabled,
}, keys)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ func Test_CreateSystem(t *testing.T) {
system.VisitEngines(func(engine core.Engine) {
numEngines++
})
assert.Equal(t, 16, numEngines)
assert.Equal(t, 17, numEngines)
}

func Test_ClientCommand_ErrorHandlers(t *testing.T) {
Expand Down
36 changes: 0 additions & 36 deletions policy/api/v1/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ func NewHTTPClient(strictMode bool, timeout time.Duration, tlsConfig *tls.Config
}
}

<<<<<<< HEAD
// PresentationDefinition retrieves the presentation definition from the presentation definition endpoint for the given scope and authorizer.
=======
// PresentationDefinition retrieves the presentation definition from the presentation definition endpoint for the given scope and .
>>>>>>> 6008f49e (added authorized client API and tests)
func (hb HTTPClient) PresentationDefinition(ctx context.Context, serverAddress string, authorizer did.DID, scopes string) (*pe.PresentationDefinition, error) {
_, err := core.ParsePublicURL(serverAddress, hb.strictMode)
if err != nil {
Expand Down Expand Up @@ -112,35 +108,3 @@ func (hb HTTPClient) Authorized(ctx context.Context, serverAddress string, reque

return authorizedResponse.JSON200.Authorized, nil
}

func (hb HTTPClient) Authorized(ctx context.Context, serverAddress string, request AuthorizedRequest) (bool, error) {
_, err := core.ParsePublicURL(serverAddress, hb.strictMode)
if err != nil {
return false, err
}

client, err := NewClient(serverAddress, WithHTTPClient(hb.httpClient))
if err != nil {
return false, err
}

response, err := client.CheckAuthorized(ctx, request)
if err != nil {
return false, fmt.Errorf("failed to call endpoint: %w", err)
}
if httpErr := core.TestResponseCode(http.StatusOK, response); httpErr != nil {
return false, httpErr
}

var authorized bool
var data []byte

if data, err = io.ReadAll(response.Body); err != nil {
return false, fmt.Errorf("unable to read response: %w", err)
}
if err = json.Unmarshal(data, &authorized); err != nil {
return false, fmt.Errorf("unable to unmarshal response: %w", err)
}

return authorized, nil
}

0 comments on commit d72e374

Please sign in to comment.