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