Fix federation node-pairing tests
This commit is contained in:
@@ -363,9 +363,11 @@ func (svc node) HandshakeConfirm(ctx context.Context, nodeID uint64) error {
|
||||
return err
|
||||
}
|
||||
|
||||
var accessToken []byte
|
||||
// Generate JWT token for the federated user
|
||||
accessToken, err = svc.tokenIssuer(ctx, u)
|
||||
var accessToken []byte
|
||||
if accessToken, err = svc.tokenIssuer(ctx, u); err != nil {
|
||||
return fmt.Errorf("could not confirm handshake: %w", err)
|
||||
}
|
||||
|
||||
n.UpdatedBy = auth.GetIdentityFromContext(ctx).Identity()
|
||||
n.UpdatedAt = now()
|
||||
|
||||
@@ -95,6 +95,7 @@ func Initialize(_ context.Context, log *zap.Logger, s store.Storer, c Config) (e
|
||||
ctx,
|
||||
auth.WithIdentity(i),
|
||||
auth.WithScope("api"),
|
||||
auth.WithAudience("federation"),
|
||||
)
|
||||
},
|
||||
c.Federation,
|
||||
|
||||
@@ -180,10 +180,6 @@ func TestSuccessfulNodePairing(t *testing.T) {
|
||||
service.DefaultNode.SetHandshaker(&mockNodeHandshake{
|
||||
init: func(ctx context.Context, n *types.Node, authToken string) error {
|
||||
h.apiInit().
|
||||
Debug().
|
||||
// make sure we do not use test auth-token for authentication but
|
||||
// we do it with pairing token
|
||||
Intercept(helpers.ReqHeaderRawAuthBearer([]byte(n.AuthToken))).
|
||||
Post(fmt.Sprintf("/nodes/%d/handshake", n.SharedNodeID)).
|
||||
FormData("pairToken", n.PairToken).
|
||||
FormData("authToken", authToken).
|
||||
|
||||
Reference in New Issue
Block a user