mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
minor
This commit is contained in:
parent
872dd45359
commit
c5139b22ee
|
@ -41,6 +41,15 @@ func withCookieOptions(ctx iris.Context) {
|
||||||
// * CookieExpires
|
// * CookieExpires
|
||||||
// * CookieEncoding
|
// * CookieEncoding
|
||||||
ctx.AddCookieOptions(iris.CookieAllowReclaim())
|
ctx.AddCookieOptions(iris.CookieAllowReclaim())
|
||||||
|
// ctx.AddCookieOptions(iris.CookieSecure)
|
||||||
|
// OR for a specific cookie:
|
||||||
|
// ctx.SetCookieKV("cookie_name", "cookie_value", iris.CookieScure)
|
||||||
|
// OR by passing a a &http.Cookie:
|
||||||
|
// ctx.SetCookie(&http.Cookie{
|
||||||
|
// Name: "cookie_name",
|
||||||
|
// Value: "cookie_value",
|
||||||
|
// Secure: true,
|
||||||
|
// })
|
||||||
ctx.Next()
|
ctx.Next()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,11 @@ func logout(ctx iris.Context) {
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
app := iris.New()
|
app := iris.New()
|
||||||
sess := sessions.New(sessions.Config{Cookie: cookieNameForSessionID, AllowReclaim: true})
|
sess := sessions.New(sessions.Config{
|
||||||
|
Cookie: cookieNameForSessionID,
|
||||||
|
// CookieSecureTLS: true,
|
||||||
|
AllowReclaim: true,
|
||||||
|
})
|
||||||
app.Use(sess.Handler())
|
app.Use(sess.Handler())
|
||||||
// ^ or comment this line and use sess.Start(ctx) inside your handlers
|
// ^ or comment this line and use sess.Start(ctx) inside your handlers
|
||||||
// instead of sessions.Get(ctx).
|
// instead of sessions.Get(ctx).
|
||||||
|
|
Loading…
Reference in New Issue
Block a user