Skip to content

Commit

Permalink
revert extraction of oauth server metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
woutslakhorst committed Dec 8, 2023
1 parent e99f762 commit d0c5ae0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
13 changes: 2 additions & 11 deletions auth/services/oauth/relying_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ func (s *relyingParty) RequestRFC003AccessToken(ctx context.Context, jwtGrantTok

func (s *relyingParty) RequestRFC021AccessToken(ctx context.Context, requester did.DID, verifier did.DID, scopes string) (*oauth.TokenResponse, error) {
iamClient := iam.NewHTTPClient(s.strictMode, s.httpClientTimeout, s.httpClientTLS)
metadata, err := s.authorizationServerMetadata(ctx, verifier)
metadata, err := iamClient.OAuthAuthorizationServerMetadata(ctx, verifier)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to retrieve remote OAuth Authorization Server metadata: %w", err)
}

// get the presentation definition from the verifier
Expand Down Expand Up @@ -193,15 +193,6 @@ func (s *relyingParty) RequestRFC021AccessToken(ctx context.Context, requester d
}, nil
}

func (s *relyingParty) authorizationServerMetadata(ctx context.Context, webdid did.DID) (*oauth.AuthorizationServerMetadata, error) {
iamClient := iam.NewHTTPClient(s.strictMode, s.httpClientTimeout, s.httpClientTLS)
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 determineFormat(formats map[string]map[string][]string) (string, error) {
for format := range formats {
switch format {
Expand Down
21 changes: 0 additions & 21 deletions auth/services/oauth/relying_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,27 +371,6 @@ func TestService_CreateJwtBearerToken(t *testing.T) {
})
}

func TestRelyingParty_authorizationServerMetadata(t *testing.T) {
t.Run("ok", func(t *testing.T) {
ctx := createOAuthRPContext(t)

metadata, err := ctx.relyingParty.authorizationServerMetadata(context.Background(), ctx.verifierDID)

require.NoError(t, err)
require.NotNil(t, metadata)
assert.Equal(t, ctx.authzServerMetadata, *metadata)
})
t.Run("error - failed to get metadata", func(t *testing.T) {
ctx := createOAuthRPContext(t)
ctx.metadata = nil

_, err := ctx.relyingParty.authorizationServerMetadata(context.Background(), ctx.verifierDID)

require.Error(t, err)
assert.EqualError(t, err, "failed to retrieve remote OAuth Authorization Server metadata: server returned HTTP 404 (expected: 200)")
})
}

type rpTestContext struct {
ctrl *gomock.Controller
keyStore *crypto.MockKeyStore
Expand Down

0 comments on commit d0c5ae0

Please sign in to comment.