2019-10-07 08:14:47 -06:00
|
|
|
// Copyright (c) Mainflux
|
2018-08-26 13:15:48 +02:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2018-05-10 23:53:25 +02:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package mainflux;
|
|
|
|
|
2019-07-15 18:28:15 +02:00
|
|
|
import "google/protobuf/empty.proto";
|
|
|
|
|
2018-05-15 17:13:09 +02:00
|
|
|
service ThingsService {
|
2019-10-21 15:24:45 -06:00
|
|
|
rpc CanAccessByKey(AccessByKeyReq) returns (ThingID) {}
|
2021-02-22 19:41:59 +01:00
|
|
|
rpc IsChannelOwner(ChannelOwnerReq) returns (google.protobuf.Empty) {}
|
2019-07-15 18:28:15 +02:00
|
|
|
rpc CanAccessByID(AccessByIDReq) returns (google.protobuf.Empty) {}
|
2018-05-21 12:51:46 +02:00
|
|
|
rpc Identify(Token) returns (ThingID) {}
|
2018-05-10 23:53:25 +02:00
|
|
|
}
|
|
|
|
|
2020-12-29 23:02:35 +01:00
|
|
|
service AuthService {
|
2019-12-16 16:22:09 +01:00
|
|
|
rpc Issue(IssueReq) returns (Token) {}
|
2020-10-27 19:42:53 +01:00
|
|
|
rpc Identify(Token) returns (UserIdentity) {}
|
2020-12-29 23:02:35 +01:00
|
|
|
rpc Authorize(AuthorizeReq) returns (AuthorizeRes) {}
|
2021-10-27 00:38:28 +02:00
|
|
|
rpc AddPolicy(AddPolicyReq) returns (AddPolicyRes) {}
|
|
|
|
rpc DeletePolicy(DeletePolicyReq) returns (DeletePolicyRes) {}
|
2021-11-19 16:32:38 +03:00
|
|
|
rpc ListPolicies(ListPoliciesReq) returns (ListPoliciesRes) {}
|
2020-12-29 23:02:35 +01:00
|
|
|
rpc Assign(Assignment) returns(google.protobuf.Empty) {}
|
|
|
|
rpc Members(MembersReq) returns (MembersRes) {}
|
2018-05-10 23:53:25 +02:00
|
|
|
}
|
|
|
|
|
2019-10-21 15:24:45 -06:00
|
|
|
message AccessByKeyReq {
|
2019-12-16 16:22:09 +01:00
|
|
|
string token = 1;
|
2018-12-05 13:09:25 +01:00
|
|
|
string chanID = 2;
|
2018-05-21 12:51:46 +02:00
|
|
|
}
|
|
|
|
|
2021-02-22 19:41:59 +01:00
|
|
|
message ChannelOwnerReq {
|
|
|
|
string owner = 1;
|
|
|
|
string chanID = 2;
|
|
|
|
}
|
|
|
|
|
2018-05-21 12:51:46 +02:00
|
|
|
message ThingID {
|
2018-12-05 13:09:25 +01:00
|
|
|
string value = 1;
|
2018-05-10 23:53:25 +02:00
|
|
|
}
|
|
|
|
|
2021-02-22 19:41:59 +01:00
|
|
|
message ChannelID {
|
|
|
|
string value = 1;
|
|
|
|
}
|
|
|
|
|
2019-07-15 18:28:15 +02:00
|
|
|
message AccessByIDReq {
|
|
|
|
string thingID = 1;
|
2019-12-16 16:22:09 +01:00
|
|
|
string chanID = 2;
|
2019-07-15 18:28:15 +02:00
|
|
|
}
|
|
|
|
|
2019-12-16 16:22:09 +01: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-10 23:53:25 +02:00
|
|
|
message Token {
|
|
|
|
string value = 1;
|
|
|
|
}
|
|
|
|
|
2020-10-27 19:42:53 +01:00
|
|
|
message UserIdentity {
|
|
|
|
string id = 1;
|
|
|
|
string email = 2;
|
2018-05-10 23:53:25 +02:00
|
|
|
}
|
2019-12-16 16:22:09 +01:00
|
|
|
|
|
|
|
message IssueReq {
|
2020-10-27 19:42:53 +01:00
|
|
|
string id = 1;
|
|
|
|
string email = 2;
|
|
|
|
uint32 type = 3;
|
2019-12-16 16:22:09 +01:00
|
|
|
}
|
2020-12-29 23:02:35 +01:00
|
|
|
|
|
|
|
message AuthorizeReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message AuthorizeRes {
|
|
|
|
bool authorized = 1;
|
|
|
|
}
|
|
|
|
|
2021-10-27 00:38:28 +02: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 16:32:38 +03:00
|
|
|
message ListPoliciesReq {
|
|
|
|
string sub = 1;
|
|
|
|
string obj = 2;
|
|
|
|
string act = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListPoliciesRes {
|
|
|
|
repeated string policies = 1;
|
|
|
|
}
|
|
|
|
|
2020-12-29 23:02:35 +01: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;
|
|
|
|
}
|