2020-02-03 08:16:02 +00:00
|
|
|
syntax = "proto3";
|
|
|
|
|
|
|
|
package go.micro.auth;
|
|
|
|
|
|
|
|
service Auth {
|
2020-03-23 16:19:30 +00:00
|
|
|
rpc Generate(GenerateRequest) returns (GenerateResponse) {};
|
2020-03-31 10:06:13 +01:00
|
|
|
rpc Inspect(InspectRequest) returns (InspectResponse) {};
|
|
|
|
rpc Token(TokenRequest) returns (TokenResponse) {};
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-31 10:18:50 +01:00
|
|
|
service Accounts {
|
|
|
|
rpc List(ListAccountsRequest) returns (ListAccountsResponse) {};
|
|
|
|
}
|
|
|
|
|
|
|
|
service Rules {
|
|
|
|
rpc Create(CreateRequest) returns (CreateResponse) {};
|
|
|
|
rpc Delete(DeleteRequest) returns (DeleteResponse) {};
|
|
|
|
rpc List(ListRequest) returns (ListResponse) {};
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListAccountsRequest {
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListAccountsResponse {
|
|
|
|
repeated Account accounts = 1;
|
|
|
|
}
|
|
|
|
|
2020-03-23 16:19:30 +00:00
|
|
|
message Token {
|
2020-04-01 14:25:00 +01:00
|
|
|
string access_token = 1;
|
|
|
|
string refresh_token = 2;
|
2020-02-25 22:15:44 +00:00
|
|
|
int64 created = 3;
|
|
|
|
int64 expiry = 4;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-23 16:19:30 +00:00
|
|
|
message Account {
|
|
|
|
string id = 1;
|
2020-03-31 19:01:43 +01:00
|
|
|
string type = 2;
|
2020-03-23 16:19:30 +00:00
|
|
|
repeated string roles = 3;
|
|
|
|
map<string, string> metadata = 4;
|
2020-03-30 09:51:37 +01:00
|
|
|
string namespace = 5;
|
2020-04-01 14:25:00 +01:00
|
|
|
string provider = 6;
|
2020-04-01 17:20:02 +01:00
|
|
|
string secret = 7;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message Resource{
|
2020-02-25 22:15:44 +00:00
|
|
|
string name = 1;
|
|
|
|
string type = 2;
|
2020-03-23 16:19:30 +00:00
|
|
|
string endpoint = 3;
|
2020-04-02 17:01:06 +01:00
|
|
|
string namespace = 4;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message GenerateRequest {
|
2020-03-23 16:19:30 +00:00
|
|
|
string id = 1;
|
|
|
|
repeated string roles = 2;
|
|
|
|
map<string, string> metadata = 3;
|
2020-03-31 10:06:13 +01:00
|
|
|
string namespace = 4;
|
2020-03-31 18:17:01 +01:00
|
|
|
string secret = 5;
|
|
|
|
string type = 6;
|
2020-03-31 19:01:43 +01:00
|
|
|
string provider = 7;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message GenerateResponse {
|
2020-02-25 22:15:44 +00:00
|
|
|
Account account = 1;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-23 16:19:30 +00:00
|
|
|
message GrantRequest {
|
|
|
|
string role = 1;
|
|
|
|
Resource resource = 2;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
2020-03-23 16:19:30 +00:00
|
|
|
message GrantResponse {}
|
|
|
|
|
2020-02-03 08:16:02 +00:00
|
|
|
message RevokeRequest {
|
2020-03-23 16:19:30 +00:00
|
|
|
string role = 1;
|
|
|
|
Resource resource = 2;
|
2020-02-03 08:16:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
message RevokeResponse {}
|
2020-03-23 16:19:30 +00:00
|
|
|
|
|
|
|
message InspectRequest {
|
|
|
|
string token = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
message InspectResponse {
|
|
|
|
Account account = 1;
|
|
|
|
}
|
|
|
|
|
2020-03-31 10:06:13 +01:00
|
|
|
message TokenRequest {
|
|
|
|
string id = 1;
|
2020-04-01 14:25:00 +01:00
|
|
|
string secret = 2;
|
|
|
|
string refresh_token = 3;
|
|
|
|
int64 token_expiry = 4;
|
2020-03-23 16:19:30 +00:00
|
|
|
}
|
|
|
|
|
2020-03-31 10:06:13 +01:00
|
|
|
message TokenResponse {
|
2020-03-23 16:19:30 +00:00
|
|
|
Token token = 1;
|
2020-03-31 00:35:11 +03:00
|
|
|
}
|
2020-03-31 10:18:50 +01:00
|
|
|
|
|
|
|
enum Access {
|
|
|
|
UNKNOWN = 0;
|
|
|
|
GRANTED = 1;
|
|
|
|
DENIED = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
message Rule {
|
|
|
|
string id = 1;
|
|
|
|
string role = 2;
|
|
|
|
Resource resource = 3;
|
|
|
|
Access access = 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CreateRequest {
|
|
|
|
string role = 1;
|
|
|
|
Resource resource = 2;
|
|
|
|
Access access = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message CreateResponse {}
|
|
|
|
|
|
|
|
message DeleteRequest {
|
|
|
|
string role = 1;
|
|
|
|
Resource resource = 2;
|
|
|
|
Access access = 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
message DeleteResponse {}
|
|
|
|
|
|
|
|
message ListRequest {
|
|
|
|
}
|
|
|
|
|
|
|
|
message ListResponse {
|
|
|
|
repeated Rule rules = 1;
|
|
|
|
}
|