|
@@ -192,6 +192,73 @@ func (h *ZLLAuthGinHandler) wh_Login(ctx *gin.Context) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+type HandlingOtherEncryptedRequestNextFunc func(returnData interface{})
|
|
|
+
|
|
|
+func (h *ZLLAuthGinHandler) HandlingOtherEncryptedRequest(ctx *gin.Context, v interface{}) (isOK bool, next HandlingOtherEncryptedRequestNextFunc) {
|
|
|
+ isOK = false
|
|
|
+ next = nil
|
|
|
+ var jdata JsonDef_LoginArugument
|
|
|
+ err := ctx.BindJSON(&jdata)
|
|
|
+ if err != nil {
|
|
|
+ if h.elh != nil {
|
|
|
+ h.elh.JsonDecodeError("oerutil", ctx.Request, err)
|
|
|
+ }
|
|
|
+ ctx.JSON(200, gin.H{
|
|
|
+ "suc": false,
|
|
|
+ "err_hcode": 400,
|
|
|
+ "err_ecode": 2,
|
|
|
+ "err_msg": "invalid arguments",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ve, ie := h.zllhdl.HandlingOtherEncryptedRequest(jdata.LoginData, v)
|
|
|
+ if h.elh != nil {
|
|
|
+ h.elh.HandlingOtherEncryptedRequestFailed(ctx.Request, ve, ie)
|
|
|
+ }
|
|
|
+ if ve == zllauth1.LFT_SUCCESS {
|
|
|
+ isOK = true
|
|
|
+ next = func(returnData interface{}) {
|
|
|
+ ctx.JSON(200, gin.H{
|
|
|
+ "suc": true,
|
|
|
+ "data": returnData,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+ }
|
|
|
+ switch ve {
|
|
|
+ case zllauth1.LFT_DECODE_HEX_FAIL:
|
|
|
+ {
|
|
|
+ ctx.JSON(200, gin.H{
|
|
|
+ "suc": true,
|
|
|
+ "login_suc": false,
|
|
|
+ "login_ecode": "argument_transport_error",
|
|
|
+ "external_info": "decode hex failed",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ case zllauth1.LFT_DECRYPT_SM2_FAIL:
|
|
|
+ {
|
|
|
+ ctx.JSON(200, gin.H{
|
|
|
+ "suc": true,
|
|
|
+ "login_suc": false,
|
|
|
+ "login_ecode": "argument_transport_error",
|
|
|
+ "external_info": "decrypt sm2 failed",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ default:
|
|
|
+ {
|
|
|
+ ctx.JSON(200, gin.H{
|
|
|
+ "suc": false,
|
|
|
+ "err_hcode": 502,
|
|
|
+ "err_ecode": 3,
|
|
|
+ "err_msg": "internal server error",
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func (h *ZLLAuthGinHandler) CheckJWT(jwtstr string) (ok bool, extData map[string]interface{}) {
|
|
|
se, exi, _, _ := h.zllhdl.CheckJWT(jwtstr)
|
|
|
if se {
|