Skip to content

Commit

Permalink
Spread the use of option SameSite to tracking cookies (crewjam#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
sly-roar authored Dec 14, 2020
1 parent 60b9b0c commit cc774ea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions samlsp/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func DefaultRequestTracker(opts Options, serviceProvider *saml.ServiceProvider)
NamePrefix: "saml_",
Codec: DefaultTrackedRequestCodec(opts),
MaxAge: saml.MaxIssueDelay,
SameSite: opts.CookieSameSite,
}
}

Expand Down
2 changes: 2 additions & 0 deletions samlsp/request_tracker_cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type CookieRequestTracker struct {
NamePrefix string
Codec TrackedRequestCodec
MaxAge time.Duration
SameSite http.SameSite
}

// TrackRequest starts tracking the SAML request with the given ID. It returns an
Expand All @@ -39,6 +40,7 @@ func (t CookieRequestTracker) TrackRequest(w http.ResponseWriter, r *http.Reques
Value: signedTrackedRequest,
MaxAge: int(t.MaxAge.Seconds()),
HttpOnly: true,
SameSite: t.SameSite,
Secure: t.ServiceProvider.AcsURL.Scheme == "https",
Path: t.ServiceProvider.AcsURL.Path,
})
Expand Down

0 comments on commit cc774ea

Please sign in to comment.