Skip to content

Commit 7c9cb20

Browse files
committed
CookieSessionProvider: add Path
fixes crewjam#533
1 parent 97deba2 commit 7c9cb20

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

samlsp/session_cookie.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ type CookieSessionProvider struct {
2121
Secure bool
2222
SameSite http.SameSite
2323
MaxAge time.Duration
24+
Path string
2425
Codec SessionCodec
2526
}
2627

@@ -43,6 +44,11 @@ func (c CookieSessionProvider) CreateSession(w http.ResponseWriter, r *http.Requ
4344
return err
4445
}
4546

47+
path := c.Path
48+
if path == "" {
49+
path = "/"
50+
}
51+
4652
http.SetCookie(w, &http.Cookie{
4753
Name: c.Name,
4854
Domain: c.Domain,
@@ -51,7 +57,7 @@ func (c CookieSessionProvider) CreateSession(w http.ResponseWriter, r *http.Requ
5157
HttpOnly: c.HTTPOnly,
5258
Secure: c.Secure || r.URL.Scheme == "https",
5359
SameSite: c.SameSite,
54-
Path: "/",
60+
Path: path,
5561
})
5662
return nil
5763
}

0 commit comments

Comments
 (0)