chore: golint
This commit is contained in:
parent
dbe6b16dce
commit
d7190ebe79
|
@ -17,18 +17,20 @@ message AuthorizationReq {
|
|||
string device_id = 2;
|
||||
// scope 表示授權範圍
|
||||
string scope = 3;
|
||||
// 角色
|
||||
string role = 4;
|
||||
// data 是一個通用的 key-value 結構,用於存儲額外數據
|
||||
map<string,string> data = 4;
|
||||
map<string,string> data = 5;
|
||||
// is_refresh_token 表示是否為刷新令牌
|
||||
bool is_refresh_token = 5;
|
||||
bool is_refresh_token = 6;
|
||||
// 發送token 的 uid
|
||||
string uid =6;
|
||||
string uid =7;
|
||||
// 發送token 的 account
|
||||
string account = 7;
|
||||
string account = 8;
|
||||
// expires 表示過期時間(unixnamo utc 時間)
|
||||
optional int64 expires = 8;
|
||||
optional int64 expires = 9;
|
||||
// expires 表示過期時間(unixnamo utc 時間)
|
||||
optional int64 refreshExpire = 9;
|
||||
optional int64 refreshExpire = 10;
|
||||
}
|
||||
|
||||
// TokenResp 定義訪問令牌響應的結構
|
||||
|
|
|
@ -29,8 +29,6 @@ func NewNewTokenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *NewToken
|
|||
// NewToken 建立一個新的 Token,例如:AccessToken
|
||||
func (l *NewTokenLogic) NewToken(in *permission.AuthorizationReq) (*permission.TokenResp, error) {
|
||||
tokenType := token.Bearer
|
||||
// TODO 要去拿 talbe
|
||||
role := "user"
|
||||
|
||||
var expired, refreshExpired int64
|
||||
if in.GetExpires() > 0 {
|
||||
|
@ -51,7 +49,7 @@ func (l *NewTokenLogic) NewToken(in *permission.AuthorizationReq) (*permission.T
|
|||
Scope: in.GetScope(),
|
||||
Expires: expired,
|
||||
RefreshExpires: refreshExpired,
|
||||
Role: role,
|
||||
Role: in.GetRole(),
|
||||
Account: in.GetAccount(),
|
||||
UID: in.GetUid(),
|
||||
Data: in.Data,
|
||||
|
|
|
@ -8,7 +8,7 @@ import (
|
|||
"context"
|
||||
|
||||
"code.30cm.net/digimon/app-cloudep-permission-server/gen_result/pb/permission"
|
||||
tokenservicelogic "code.30cm.net/digimon/app-cloudep-permission-server/internal/logic/tokenservice"
|
||||
"code.30cm.net/digimon/app-cloudep-permission-server/internal/logic/tokenservice"
|
||||
"code.30cm.net/digimon/app-cloudep-permission-server/internal/svc"
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue