当前位置: 首页>>代码示例>>Golang>>正文


Golang Session.Delete方法代码示例

本文整理汇总了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)
	}
}
开发者ID:hoysoft,项目名称:JexGO,代码行数:11,代码来源:sessionAuth.go

示例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)
}
开发者ID:hoysoft,项目名称:JexGO,代码行数:10,代码来源:oauth2.go

示例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)
}
开发者ID:hoysoft,项目名称:JexGO,代码行数:5,代码来源:sessionAuth.go


注:本文中的github.com/hoysoft/JexGO/sessions.Session.Delete方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。