Skip to content

Commit e65a42a

Browse files
committed
session: add a new session v2 token
Session Token v2 solves the delegation, power of attorney, and chain-of-trust problems. It enables: - Account-based authority (direct or NNS-based indirect) - Multi-account subjects (multiple entities can use same token) - Multi-verb operations (GET, PUT, DELETE in single token) - Delegation chains (verifiable like X.509 certificates) - Indirect accounts (NeoFS Name Service resolution) Refs #241. Signed-off-by: Andrey Butusov <[email protected]>
1 parent a2298a0 commit e65a42a

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

session/service.proto

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ service SessionService {
2727
// - **OK** (0, SECTION_SUCCESS):
2828
// session token v2 has been successfully created;
2929
// - Common failures (SECTION_FAILURE_COMMON).
30-
rpc CreateV2(CreateRequestV2) returns (CreateResponseV2);
30+
rpc CreateV2(CreateV2Request) returns (CreateV2Response);
3131
}
3232

3333
// Information necessary for opening a session.
@@ -76,8 +76,8 @@ message CreateResponse {
7676
neo.fs.v2.session.ResponseVerificationHeader verify_header = 3;
7777
}
7878

79-
// CreateRequestV2 is information necessary for creating a session token v2.
80-
message CreateRequestV2 {
79+
// CreateV2Request is information necessary for creating a session token v2.
80+
message CreateV2Request {
8181
// Session creation request v2 body
8282
message Body {
8383
// Issuer of the session token
@@ -91,12 +91,6 @@ message CreateRequestV2 {
9191

9292
// Session creation time
9393
int64 created_at = 4 [json_name = "createdAt"];
94-
95-
// Authorization context
96-
oneof context {
97-
neo.fs.v2.session.ObjectSessionContextV2 object = 5 [json_name = "object"];
98-
neo.fs.v2.session.ContainerSessionContextV2 container = 6 [json_name = "container"];
99-
}
10094
}
10195

10296
// Body of create session token v2 request message
@@ -112,8 +106,8 @@ message CreateRequestV2 {
112106
neo.fs.v2.session.RequestVerificationHeader verify_header = 3;
113107
}
114108

115-
// CreateResponseV2 is information about a newly created session token v2.
116-
message CreateResponseV2 {
109+
// CreateV2Response is information about a newly created session token v2.
110+
message CreateV2Response {
117111
// Session creation response v2 body
118112
message Body {
119113
// The session token v2 with delegation and chain-of-trust support

session/types.proto

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ message ResponseVerificationHeader {
239239
// Account represents an identity in NeoFS.
240240
// It can be either direct (OwnerID) or indirect (NNS domain).
241241
message Account {
242+
// Account identifier
242243
oneof identifier {
243244
// Direct account reference via OwnerID (hash of public key)
244245
neo.fs.v2.refs.OwnerID owner_id = 1 [json_name = "ownerID"];
@@ -271,14 +272,30 @@ message DelegationInfo {
271272
// ObjectSessionContextV2 carries context for ObjectService requests.
272273
// Extended version supporting multiple verbs and targets.
273274
message ObjectSessionContextV2 {
275+
// Object request verbs
274276
enum Verb {
277+
// Unknown verb
275278
VERB_UNSPECIFIED = 0;
279+
280+
// Refers to object.Put RPC call
276281
PUT = 1;
282+
283+
// Refers to object.Get RPC call
277284
GET = 2;
285+
286+
// Refers to object.Head RPC call
278287
HEAD = 3;
288+
289+
// Refers to object.Search RPC call
279290
SEARCH = 4;
291+
292+
// Refers to object.Delete RPC call
280293
DELETE = 5;
294+
295+
// Refers to object.GetRange RPC call
281296
RANGE = 6;
297+
298+
// Refers to object.GetRangeHash RPC call
282299
RANGEHASH = 7;
283300
}
284301

@@ -302,10 +319,18 @@ message ObjectSessionContextV2 {
302319
// ContainerSessionContextV2 carries context for ContainerService requests.
303320
// Extended version supporting multiple verbs.
304321
message ContainerSessionContextV2 {
322+
// Container request verbs
305323
enum Verb {
324+
// Unknown verb
306325
VERB_UNSPECIFIED = 0;
326+
327+
// Refers to container.Put RPC call
307328
PUT = 1;
329+
330+
// Refers to container.Delete RPC call
308331
DELETE = 2;
332+
333+
// Refers to container.SetExtendedACL RPC call
309334
SETEACL = 3;
310335
}
311336

0 commit comments

Comments
 (0)