2019-10-07 22:14:47 +08:00
|
|
|
// Copyright (c) Mainflux
|
2018-08-26 19:15:48 +08:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-05-11 05:53:25 +08:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package mainflux;
|
|
|
|
|
2019-07-16 00:28:15 +08:00
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
|
2018-05-15 23:13:09 +08:00
|
|
|
service ThingsService {
|
2019-10-22 05:24:45 +08:00
|
|
|
rpc CanAccessByKey(AccessByKeyReq) returns (ThingID) {}
|
2021-02-23 02:41:59 +08:00
|
|
|
rpc IsChannelOwner(ChannelOwnerReq) returns (google.protobuf.Empty) {}
|
2019-07-16 00:28:15 +08:00
|
|
|
rpc CanAccessByID(AccessByIDReq) returns (google.protobuf.Empty) {}
|
2018-05-21 18:51:46 +08:00
|
|
|
rpc Identify(Token) returns (ThingID) {}
|
2018-05-11 05:53:25 +08:00
|
|
|
}
|
|
|
|
|
2020-12-30 06:02:35 +08:00
|
|
|
service AuthService {
|
2019-12-16 23:22:09 +08:00
|
|
|
rpc Issue(IssueReq) returns (Token) {}
|
2020-10-28 02:42:53 +08:00
|
|
|
rpc Identify(Token) returns (UserIdentity) {}
|
2020-12-30 06:02:35 +08:00
|
|
|
rpc Authorize(AuthorizeReq) returns (AuthorizeRes) {}
|
2021-10-27 06:38:28 +08:00
|
|
|
rpc AddPolicy(AddPolicyReq) returns (AddPolicyRes) {}
|
|
|
|
rpc DeletePolicy(DeletePolicyReq) returns (DeletePolicyRes) {}
|
2021-11-19 21:32:38 +08:00
|
|
|
rpc ListPolicies(ListPoliciesReq) returns (ListPoliciesRes) {}
|
2020-12-30 06:02:35 +08:00
|
|
|
rpc Assign(Assignment) returns(google.protobuf.Empty) {}
|
|
|
|
rpc Members(MembersReq) returns (MembersRes) {}
|
2018-05-11 05:53:25 +08:00
|
|
|
}
|
|
|
|
|
2019-10-22 05:24:45 +08:00
|
|
|
message AccessByKeyReq {
|
2019-12-16 23:22:09 +08:00
|
|
|
string token = 1;
|
2018-12-05 20:09:25 +08:00
|
|
|
string chanID = 2;
|
2018-05-21 18:51:46 +08:00
|
|
|
}
|
|
|
|
|
2021-02-23 02:41:59 +08:00
|
|
|
message ChannelOwnerReq {
|
|
|
|
string owner = 1;
|
|
|
|
string chanID = 2;
|
|
|
|
}
|
|
|
|
|
2018-05-21 18:51:46 +08:00
|
|
|
message ThingID {
|
2018-12-05 20:09:25 +08:00
|
|
|
string value = 1;
|
2018-05-11 05:53:25 +08:00
|
|
|
}
|
|
|
|
|
2021-02-23 02:41:59 +08:00
|
|
|
message ChannelID {
|
|
|
|
string value = 1;
|
|
|
|
}
|
|
|
|
|
2019-07-16 00:28:15 +08:00
|
|
|
message AccessByIDReq {
|
|
|
|
string thingID = 1;
|
2019-12-16 23:22:09 +08:00
|
|
|
string chanID = 2;
|
2019-07-16 00:28:15 +08:00
|
|
|
}
|
|
|
|
|
2019-12-16 23:22:09 +08:00
|
|
|
// If a token is not carrying any information itself, the type
|
|
|
|
// field can be used to determine how to validate the token.
|
|
|
|
// Also, different tokens can be encoded in different ways.
|
2018-05-11 05:53:25 +08:00
|
|
|
message Token {
|
|
|
|
string value = 1;
|
|
|
|
}
|
|
|
|
|
2020-10-28 02:42:53 +08:00
|
|
|
message UserIdentity {
|
|
|
|
string id = 1;
|
|
|
|
string email = 2;
|
2018-05-11 05:53:25 +08:00
|
|
|
}
|
2019-12-16 23:22:09 +08:00
|
|
|
|
|
|
|
message IssueReq {
|
2020-10-28 02:42:53 +08:00
|
|
|
string id = 1;
|
|
|
|
string email = 2;
|
|
|
|
uint32 type = 3;
|
2019-12-16 23:22:09 +08:00
|
|
|
}
|
2020-12-30 06:02:35 +08:00
|
|
|
|
|
|
|
message AuthorizeReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AuthorizeRes {
|
|
|
|
bool authorized = 1;
|
|
|
|
}
|
|
|
|
|
2021-10-27 06:38:28 +08:00
|
|
|
message AddPolicyReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AddPolicyRes {
|
|
|
|
bool authorized = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeletePolicyReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeletePolicyRes {
|
|
|
|
bool deleted = 1;
|
|
|
|
}
|
|
|
|
|
2021-11-19 21:32:38 +08:00
|
|
|
message ListPoliciesReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListPoliciesRes {
|
|
|
|
repeated string policies = 1;
|
|
|
|
}
|
|
|
|
|
2020-12-30 06:02:35 +08:00
|
|
|
message Assignment {
|
|
|
|
string token = 1;
|
|
|
|
string groupID = 2;
|
|
|
|
string memberID = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message MembersReq {
|
|
|
|
string token = 1;
|
|
|
|
string groupID = 2;
|
|
|
|
uint64 offset = 3;
|
|
|
|
uint64 limit = 4;
|
|
|
|
string type = 5;
|
|
|
|
}
|
|
|
|
|
|
|
|
message MembersRes {
|
|
|
|
uint64 total = 1;
|
|
|
|
uint64 offset = 2;
|
|
|
|
uint64 limit = 3;
|
|
|
|
string type = 4;
|
|
|
|
repeated string members = 5;
|
|
|
|
}
|