fix device decrypt flow and delete_account response stability
Build docker and publish / build (20.15.1) (push) Failing after 8m0s
Build docker and publish / build (20.15.1) (push) Failing after 8m0s
This commit is contained in:
@@ -41,10 +41,7 @@ func AuthMiddleware(svc *svc.ServiceContext) func(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
loginType := ""
|
||||
if claims["CtxLoginType"] != nil {
|
||||
loginType = claims["CtxLoginType"].(string)
|
||||
}
|
||||
loginType := parseLoginType(claims)
|
||||
if claims["identifier"] != nil {
|
||||
ctx = context.WithValue(ctx, constant.CtxKeyIdentifier, claims["identifier"].(string))
|
||||
}
|
||||
@@ -93,3 +90,17 @@ func AuthMiddleware(svc *svc.ServiceContext) func(c *gin.Context) {
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
||||
func parseLoginType(claims map[string]interface{}) string {
|
||||
if raw, exists := claims["CtxLoginType"]; exists {
|
||||
if loginType, ok := raw.(string); ok && loginType != "" {
|
||||
return loginType
|
||||
}
|
||||
}
|
||||
if raw, exists := claims["LoginType"]; exists {
|
||||
if loginType, ok := raw.(string); ok && loginType != "" {
|
||||
return loginType
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user