init project

This commit is contained in:
daniel.w 2024-08-05 16:56:19 +08:00
commit 0dc3881f7c
4 changed files with 154 additions and 0 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.idea/
go.sum
account/
gen_result/
etc/permission.yaml

View File

@ -0,0 +1 @@
DROP DATABASE IF EXISTS `ark_member`;

View File

@ -0,0 +1 @@
CREATE DATABASE IF NOT EXISTS `ark_member`;

View File

@ -0,0 +1,147 @@
syntax = "proto3";
package permission;
option go_package="./permission";
// OKResp
message OKResp {}
// AuthorizationReq
message AuthorizationReq {
// grant_type
string grant_type = 1;
// device_id ID
string device_id = 2;
// scope
string scope = 3;
// data key-value
map<string,string> data = 4;
// expires
int32 expires = 5;
// is_refresh_token
bool is_refresh_token = 6;
}
// TokenResp
message TokenResp {
// access_token
string access_token = 1;
// token_type
string token_type = 2;
// expires_in
int32 expires_in = 3;
// refresh_token
string refresh_token = 4;
}
// CreateOneTimeTokenReq 使 token,
// token
message CreateOneTimeTokenReq {
string token = 1;
}
message CreateOneTimeTokenResp {
string one_time_token = 1;
}
// RefreshTokenReq Token
message RefreshTokenReq {
string token = 1;
string scope = 2;
int64 expires = 3;
string device_id = 4;
}
// https://datatracker.ietf.org/doc/html/rfc6749#section-4.3.3
message RefreshTokenResp {
string token =1;
string one_time_token = 2;
int64 expires_in = 3;
string token_type = 4;
}
// CancelTokenReq Token
message CancelTokenReq {
string token = 1;
}
// CancelTokenReq Token
message DoTokenByUIDReq {
repeated string uid = 1;
}
// ValidationTokenReq Token
message ValidationTokenReq {
string token = 1;
}
// ValidationTokenResp Token
message ValidationTokenResp {
Token token = 1;
map<string,string> data = 2;
}
// Token
message Token {
// ID
string id = 1;
// client_id ID
int32 client_id = 2;
// uid ID
string uid = 3;
// device_id ID
string device_id = 4;
// access_token
string access_token = 5;
// expires_in
int32 expires_in = 6;
// access_create_at
int64 access_create_at = 7;
// refresh_token
string refresh_token = 8;
// refresh_expires_in
int32 refresh_expires_in = 9;
// refresh_create_at
int64 refresh_create_at = 10;
}
// DoTokenByDeviceIDReq DeviceID
message DoTokenByDeviceIDReq {
repeated string device_id = 1;
}
message Tokens{
repeated string token = 1;
}
// Token
// Biz GW
// access_token -> token , refresh_token -> one_time_token
service Token_Service {
// NewToken TokenAccessToken
rpc NewToken(AuthorizationReq) returns(TokenResp);
// RefreshToken token Token
rpc RefreshToken(RefreshTokenReq) returns(RefreshTokenResp);
// CancelToken Token One Time Toke
rpc CancelToken(CancelTokenReq) returns(OKResp);
// CancelTokenByUID Token ( Device Token) One Time Toke
rpc CancelTokenByUID(DoTokenByUIDReq) returns(OKResp);
// CancelTokenByDeviceID Token
rpc CancelTokenByDeviceID(DoTokenByDeviceIDReq) returns(OKResp);
// ValidationToken Token
rpc ValidationToken(ValidationTokenReq) returns(ValidationTokenResp);
// GetUserTokensByDeviceIDs DeviceID Tokens
rpc GetUserTokensByDeviceID(DoTokenByDeviceIDReq) returns(Tokens);
// GetUserTokensByUID UID Tokens
rpc GetUserTokensByUID(DoTokenByUIDReq) returns(Tokens);
// NewOneTimeToken 使RefreshToken
rpc NewOneTimeToken(CreateOneTimeTokenReq) returns(CreateOneTimeTokenResp);
// CancelOneTimeToken 使
rpc CancelOneTimeToken(CreateOneTimeTokenReq) returns(CreateOneTimeTokenResp);
}
//service Role_Service {}
//
//service Permission_Service {}