Example #1
0
File: auth.go Project: Ganben/blog
// get auth token via http header, cookie or form value
func (ar *AuthRouter) GetAuthToken(ctx *tango.Context) string {
	var token string
	if token = ctx.Header().Get("X-Token"); token != "" {
		return token
	}
	if token = ctx.Cookie("x-token"); token != "" {
		return token
	}
	return ctx.Form("x-token")
}