@@ -230,16 +230,7 @@ func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecr
230
230
lifetime .Exp = lifetime .Iat + epochLifetime
231
231
}
232
232
233
- idOwner := owner .NewIDFromPublicKey (& options .NeoFSKey .PrivateKey .PublicKey )
234
-
235
- a .log .Info ("check container or create" , zap .Stringer ("cid" , options .Container .ID ),
236
- zap .String ("friendly_name" , options .Container .FriendlyName ),
237
- zap .String ("placement_policy" , options .Container .PlacementPolicy ))
238
- if id , err = a .checkContainer (ctx , options .Container , idOwner ); err != nil {
239
- return err
240
- }
241
-
242
- gatesData , err := createTokens (options , lifetime , id )
233
+ gatesData , err := createTokens (options , lifetime )
243
234
if err != nil {
244
235
return err
245
236
}
@@ -251,6 +242,15 @@ func (a *Agent) IssueSecret(ctx context.Context, w io.Writer, options *IssueSecr
251
242
252
243
box .ContainerPolicy = policies
253
244
245
+ idOwner := owner .NewIDFromPublicKey (& options .NeoFSKey .PrivateKey .PublicKey )
246
+
247
+ a .log .Info ("check container or create" , zap .Stringer ("cid" , options .Container .ID ),
248
+ zap .String ("friendly_name" , options .Container .FriendlyName ),
249
+ zap .String ("placement_policy" , options .Container .PlacementPolicy ))
250
+ if id , err = a .checkContainer (ctx , options .Container , idOwner ); err != nil {
251
+ return err
252
+ }
253
+
254
254
a .log .Info ("store bearer token into NeoFS" ,
255
255
zap .Stringer ("owner_tkn" , idOwner ))
256
256
@@ -318,7 +318,7 @@ func (a *Agent) ObtainSecret(ctx context.Context, w io.Writer, options *ObtainSe
318
318
return enc .Encode (or )
319
319
}
320
320
321
- func buildEACLTable (cid * cid. ID , eaclTable []byte ) (* eacl.Table , error ) {
321
+ func buildEACLTable (eaclTable []byte ) (* eacl.Table , error ) {
322
322
table := eacl .NewTable ()
323
323
if len (eaclTable ) != 0 {
324
324
return table , table .UnmarshalJSON (eaclTable )
@@ -332,7 +332,6 @@ func buildEACLTable(cid *cid.ID, eaclTable []byte) (*eacl.Table, error) {
332
332
// matcher := eacl.MatchStringEqual
333
333
// record.AddFilter(from eacl.FilterHeaderType, matcher eacl.Match, name string, value string)
334
334
eacl .AddFormedTarget (record , eacl .RoleOthers )
335
- table .SetCID (cid )
336
335
table .AddRecord (record )
337
336
338
337
return table , nil
@@ -437,10 +436,10 @@ func buildSessionTokens(key *keys.PrivateKey, oid *owner.ID, lifetime lifetimeOp
437
436
return sessionTokens , nil
438
437
}
439
438
440
- func createTokens (options * IssueSecretOptions , lifetime lifetimeOptions , cid * cid. ID ) ([]* accessbox.GateData , error ) {
439
+ func createTokens (options * IssueSecretOptions , lifetime lifetimeOptions ) ([]* accessbox.GateData , error ) {
441
440
gates := make ([]* accessbox.GateData , len (options .GatesPublicKeys ))
442
441
443
- table , err := buildEACLTable (cid , options .EACLRules )
442
+ table , err := buildEACLTable (options .EACLRules )
444
443
if err != nil {
445
444
return nil , fmt .Errorf ("failed to build eacl table: %w" , err )
446
445
}
0 commit comments