Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
islamaliev committed Oct 24, 2024
1 parent af4e2f9 commit 2869d87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
3 changes: 1 addition & 2 deletions http/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/lestrrat-go/jwx/v2/jwt"
"github.com/sourcenetwork/immutable"

"github.com/sourcenetwork/defradb/acp/identity"
acpIdentity "github.com/sourcenetwork/defradb/acp/identity"
)

Expand Down Expand Up @@ -70,7 +69,7 @@ func AuthMiddleware(next http.Handler) http.Handler {
return
}

ctx := identity.WithContext(req.Context(), immutable.Some(ident))
ctx := acpIdentity.WithContext(req.Context(), immutable.Some(ident))
next.ServeHTTP(rw, req.WithContext(ctx))
})
}
9 changes: 4 additions & 5 deletions tests/integration/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"github.com/stretchr/testify/require"

acpIdentity "github.com/sourcenetwork/defradb/acp/identity"
identity "github.com/sourcenetwork/defradb/acp/identity"
)

// identRef is a type that refers to a specific identity of a certain type.
Expand Down Expand Up @@ -54,16 +53,16 @@ func NodeIdentity(index int) identRef {
}
}

// identityHolder holds an identity and the generated tokens for each node.
// identityHolder holds an identity and the generated tokens for each target node.
// This is used to cache the generated tokens for each node.
type identityHolder struct {
// Identity is the identity.
Identity identity.Identity
Identity acpIdentity.Identity
// NodeTokens is a map of node index to the generated token for that node.
NodeTokens map[int]string
}

func newIdentityHolder(ident identity.Identity) *identityHolder {
func newIdentityHolder(ident acpIdentity.Identity) *identityHolder {
return &identityHolder{
Identity: ident,
NodeTokens: make(map[int]string),
Expand Down Expand Up @@ -134,7 +133,7 @@ func getContextWithIdentity(ctx context.Context, s *state, ref identRef, nodeInd
return ctx
}
ident := getIdentityForRequest(s, ref, nodeIndex)
return identity.WithContext(ctx, immutable.Some(ident))
return acpIdentity.WithContext(ctx, immutable.Some(ident))
}

func getIdentityDID(s *state, ident identRef) string {
Expand Down

0 comments on commit 2869d87

Please sign in to comment.