[#40] service: Add session token context

Replace object address field with the oneof-list of session contexts. Break
the connection of the session with the object. Extend the ability to open
sessions for other needs without losing backward compatibility.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-08-11 11:11:23 +03:00 committed by Stanislav Bogatyrev
parent c65920d2ce
commit 5809f0bfbf
2 changed files with 10 additions and 7 deletions

View file

@ -147,10 +147,10 @@ User token granting rights for object manipulation
| id | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes | | id | [bytes](#bytes) | | ID is a token identifier. valid UUIDv4 represented in bytes |
| owner_id | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the manipulation object owner. | | owner_id | [refs.OwnerID](#refs.OwnerID) | | OwnerID carries identifier of the manipulation object owner. |
| verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued | | verb | [Token.Info.Verb](#service.Token.Info.Verb) | | Verb is a type of request for which the token is issued |
| address | [refs.Address](#refs.Address) | | Address is an object address for which token is issued |
| lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session | | lifetime | [TokenLifetime](#service.TokenLifetime) | | Lifetime is a lifetime of the session |
| session_key | [bytes](#bytes) | | SessionKey is a public key of session key | | session_key | [bytes](#bytes) | | SessionKey is a public key of session key |
| owner_key | [bytes](#bytes) | | OwnerKey is a public key of the token owner | | owner_key | [bytes](#bytes) | | OwnerKey is a public key of the token owner |
| object_address | [refs.Address](#refs.Address) | | object_address represents the object session context. |
<a name="service.TokenLifetime"></a> <a name="service.TokenLifetime"></a>

View file

@ -58,17 +58,20 @@ message Token {
// Verb is a type of request for which the token is issued // Verb is a type of request for which the token is issued
Verb verb = 3; Verb verb = 3;
// Address is an object address for which token is issued
refs.Address address = 4;
// Lifetime is a lifetime of the session // Lifetime is a lifetime of the session
TokenLifetime lifetime = 5; TokenLifetime lifetime = 4;
// SessionKey is a public key of session key // SessionKey is a public key of session key
bytes session_key = 6; bytes session_key = 5;
// OwnerKey is a public key of the token owner // OwnerKey is a public key of the token owner
bytes owner_key = 7; bytes owner_key = 6;
// Carries context of the session.
oneof context {
// object_address represents the object session context.
refs.Address object_address = 7;
}
} }
// token_info is a grouped information about token // token_info is a grouped information about token