Documentation ¶
Overview ¶
* @Author: reel * @Date: 2023-06-06 22:40:43 * @LastEditors: reel * @LastEditTime: 2024-03-26 07:01:09 * @Description: session初始化相关设置
* @Author: reel * @Date: 2023-06-06 19:21:05 * @LastEditors: reel * @LastEditTime: 2024-03-27 04:45:16 * @Description: session 模块
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func GenSessionKey ¶
func GenSessionKey() string
Types ¶
type Session ¶
type Session interface { CookieName() string Singular() string // 是否单用户登陆, Y表示是, N或空表示否 SetWithToken(sessionKey, sessionValue string) GetWithCookie(r *http.Request) (cookieValue, value string, err error) SetWithCookie(w http.ResponseWriter, cookieValue, internalValue string) GetWithToken(r *http.Request) (sessionKey, sessionValue string, err error) GetSessionWithCookie(r *http.Request, w http.ResponseWriter) (sessionValue string, err error) SetWithSid(w http.ResponseWriter, cookieValue, internalValue string) GetWithSid(r *http.Request) (sessionKey, sessionValue string, err error) // 服务端想客户端设置cookie, 使用请求头的X-CSRF-TOKEN字段 SetWithCsrfToken(w http.ResponseWriter, cookieValue, internalValue string) // 客户端发送请求, 使用cookie传输 GetWithCsrfToken(r *http.Request) (sessionKey, sessionValue string, err error) // contains filtered or unexported methods }
Click to show internal directories.
Click to hide internal directories.