1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 21:07:03 +00:00

first release of SSO package and more examples

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-03-28 14:00:26 +03:00
parent 45d693850b
commit cf36063adf
33 changed files with 1805 additions and 67 deletions

View File

@@ -5314,7 +5314,11 @@ type SecureCookie interface {
//
// Example: https://github.com/kataras/iris/tree/master/_examples/cookies/securecookie
func CookieEncoding(encoding SecureCookie, cookieNames ...string) CookieOption {
return func(_ *Context, c *http.Cookie, op uint8) {
if encoding == nil {
return func(_ *Context, _ *http.Cookie, _ uint8) {}
}
return func(ctx *Context, c *http.Cookie, op uint8) {
if op == OpCookieDel {
return
}
@@ -5328,10 +5332,12 @@ func CookieEncoding(encoding SecureCookie, cookieNames ...string) CookieOption {
// Should encode, it's a write to the client operation.
newVal, err := encoding.Encode(c.Name, c.Value)
if err != nil {
ctx.Application().Logger().Error(err)
c.Value = ""
} else {
c.Value = newVal
}
return
case OpCookieGet:
// Should decode, it's a read from the client operation.