func FistCookieUpdateUserInfo(response *restful.Response, userInfo *UserInfo) {
	loginCookieSetter(response, userInfo)
}
FistCookieUpdateUserInfo is update fist cookie user info
package rbac
import (
	"encoding/json"
	"strings"
	"github.com/emicklei/go-restful"
	"github.com/fanux/fist/tools"
	"github.com/wonderivan/logger"
)
const desCookieKey = "df9gtsq3"
func generatorCookieValue(userInfo *UserInfo) string {
	userJSON, err := json.Marshal(userInfo)
	if err != nil {
		logger.Error("json format error:", err)
	}
	desVal := tools.DESEncrypt([]byte(string(userJSON)+"@@@@@@"+tools.MD5(string(userJSON))), []byte(desCookieKey))
	return desVal
}
func getUserInfoFromToken(token string) *UserInfo {
	desVal := tools.DESDecrypt(token, []byte(desCookieKey))
	data := strings.Split(desVal, "@@@@@@")
	if len(data) == 2 {
		md5Val := data[1]
		serialVal := data[0]
		if tools.MD5(serialVal) == md5Val {
			userInfo := &UserInfo{}
			err := json.Unmarshal([]byte(serialVal), userInfo)
			if err != nil {
				logger.Error(err)
			} else {
				return userInfo
			}
		} else {
			logger.Error("the md5 value not equals serial data")
		}
	} else {
		logger.Error("validateCookieToken data spilt length not equals 2")
	}
	return nil
}
func validateCookieToken(token, username string) bool {
	userInfo := getUserInfoFromToken(token)
	if userInfo != nil {
		return username == userInfo.Username
	}
	return false
}
func loginCookieSetter(response *restful.Response, userInfo *UserInfo) {
	tools.CookieWriteValue(response, "username", userInfo.Username)
	tools.CookieWriteValue(response, "logged", "yes")
	tools.CookieWriteValue(response, "user_token", generatorCookieValue(userInfo))
}
func logoutCookieSetter(response *restful.Response) {
	tools.CookieRemoveValue(response, "username")
	tools.CookieRemoveValue(response, "logged")
	tools.CookieRemoveValue(response, "user_token")
}
func filterCookieValidate(req *restful.Request) bool {
	logged := tools.CookieRead(req, "logged")  
	token := tools.CookieRead(req, "user_token")
	username := tools.CookieRead(req, "username")
	if "yes" == logged && validateCookieToken(token, username) {
		return true
	}
	return false
}
func FistCookieGetUserInfo(req *restful.Request) *UserInfo {
	if filterCookieValidate(req) {
		token := tools.CookieRead(req, "user_token")
		return getUserInfoFromToken(token)
	}
	return nil
}