本文整理汇总了Golang中github.com/hoysoft/JexGO/sessions.Session.Delete方法的典型用法代码示例。如果您正苦于以下问题:Golang Session.Delete方法的具体用法?Golang Session.Delete怎么用?Golang Session.Delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/hoysoft/JexGO/sessions.Session
的用法示例。
在下文中一共展示了Session.Delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: LoginRequired
// LoginRequired verifies that the current user is authenticated. Any routes that
// require a login should have this handler placed in the flow. If the user is not
// authenticated, they will be redirected to /login with the "next" get parameter
// set to the attempted URL.
func LoginRequired(s sessions.Session, r render.Render, user IUser, req *http.Request) {
if user.IsAuthenticated() == false {
s.Delete(SessionKey)
path := fmt.Sprintf("%s?%s=%s", RedirectUrl, RedirectParam, req.URL.Path)
r.Redirect(path, 302)
}
}
示例2: logoutHandle
func logoutHandle(f *Config, c martini.Context, s sessions.Session, w http.ResponseWriter, r *http.Request) {
s.Delete(keyToken)
path := fmt.Sprintf("%s?client_id=%s&client_secret=%s", f.Endpoint.LogoutURL, f.ClientID, f.ClientSecret)
utils.HttpGetString(path)
// fmt.Println("oauth logout result:",string(str))
f.ClientID = ""
f.ClientSecret = ""
c.Invoke(Logout)
http.Redirect(w, r, "/", 302)
}
示例3: Logout
// Logout will clear out the session and call the Logout() user function.
func Logout(s sessions.Session, user IUser) {
user.Logout()
s.Delete(SessionKey)
}