1
This commit is contained in:
parent
287209a382
commit
5dc2af5cf6
@ -26,19 +26,23 @@ func JwtAuth(c *gin.Context) {
|
||||
JwksUri string `json:"jwksUri"`
|
||||
Data string `json:"data"`
|
||||
}{
|
||||
JwksUri: mt.Table.Config.GetJwksUri(),
|
||||
Data: jwtToken,
|
||||
}
|
||||
jsonRspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
TransId string `json:"trans_id"`
|
||||
Params []string `json:"params"`
|
||||
}{
|
||||
Params: []string{},
|
||||
}
|
||||
rspObj := &struct {
|
||||
ErrCode interface{} `json:"errcode"`
|
||||
ErrMsg string `json:"errmsg"`
|
||||
Decoded struct {
|
||||
Sub string `json:"sub"`
|
||||
Email string `json:"email"`
|
||||
EmailVerified bool `json:"email_verified"`
|
||||
Sid string `json:"sid"`
|
||||
} `json:"decoded"`
|
||||
}{}
|
||||
paramsStr := q5.EncodeJson(jsonReqObj)
|
||||
url := fmt.Sprintf("%s/webapp/index.php", mt.Table.Web3ServiceCluster.RandElement().GetUrl())
|
||||
@ -54,11 +58,11 @@ func JwtAuth(c *gin.Context) {
|
||||
rspObj.ErrCode = 500
|
||||
rspObj.ErrMsg = "server internal error"
|
||||
c.JSON(200, rspObj)
|
||||
c.Abort()
|
||||
return
|
||||
}
|
||||
rspObj.ErrCode = q5.SafeToInt32(jsonRspObj.ErrCode)
|
||||
rspObj.ErrMsg = jsonRspObj.ErrMsg
|
||||
c.JSON(200, rspObj)
|
||||
c.Next()
|
||||
})
|
||||
c.Next()
|
||||
}
|
||||
|
@ -18,6 +18,10 @@ func (this *ConfigTable) GetGameApiUrl() string {
|
||||
return this.selfConf.GetGameapiUrl()
|
||||
}
|
||||
|
||||
func (this *ConfigTable) GetJwksUri() string {
|
||||
return this.selfConf.GetJwksUri()
|
||||
}
|
||||
|
||||
func (this *ConfigTable) PostInit1() {
|
||||
this.selfConf = this.GetById(int64(0))
|
||||
if this.selfConf == nil {
|
||||
|
@ -48,6 +48,7 @@ type GameDb struct {
|
||||
|
||||
type Config struct {
|
||||
gameapi_url string
|
||||
jwks_uri string
|
||||
|
||||
_flags1_ uint64
|
||||
_flags2_ uint64
|
||||
@ -228,6 +229,14 @@ func (this *Config) HasGameapiUrl() bool {
|
||||
return (this._flags1_ & (uint64(1) << 1)) > 0
|
||||
}
|
||||
|
||||
func (this *Config) GetJwksUri() string {
|
||||
return this.jwks_uri
|
||||
}
|
||||
|
||||
func (this *Config) HasJwksUri() bool {
|
||||
return (this._flags1_ & (uint64(1) << 2)) > 0
|
||||
}
|
||||
|
||||
func (this *Item) GetName() string {
|
||||
return this.name
|
||||
}
|
||||
@ -301,6 +310,7 @@ func (this *GameDb) LoadFromKv(kv map[string]interface{}) {
|
||||
|
||||
func (this *Config) LoadFromKv(kv map[string]interface{}) {
|
||||
f5.ReadMetaTableField(&this.gameapi_url, "gameapi_url", &this._flags1_, 1, kv)
|
||||
f5.ReadMetaTableField(&this.jwks_uri, "jwks_uri", &this._flags1_, 2, kv)
|
||||
}
|
||||
|
||||
func (this *Item) LoadFromKv(kv map[string]interface{}) {
|
||||
|
@ -39,6 +39,7 @@ message GameDb
|
||||
message Config
|
||||
{
|
||||
optional string gameapi_url = 1;
|
||||
optional string jwks_uri = 2;
|
||||
}
|
||||
|
||||
message Item
|
||||
|
Loading…
x
Reference in New Issue
Block a user