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 12, 2023
1 parent df0bff0 commit 517cb27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 23 deletions.
4 changes: 2 additions & 2 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
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 @@ -380,27 +380,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 517cb27

Please sign in to comment.