Fix http.Cookie SameSite is not copied. (#450)
* fix: http.Cookie SameSite is not copied. * Update CHANGELOG.md
This commit is contained in:
		
							parent
							
								
									3108f765a5
								
							
						
					
					
						commit
						362cdf7713
					
				|  | @ -9,6 +9,7 @@ | ||||||
| 
 | 
 | ||||||
| ## Changes since v5.0.0 | ## Changes since v5.0.0 | ||||||
| 
 | 
 | ||||||
|  | - [#450](https://github.com/pusher/oauth2_proxy/pull/450) Fix http.Cookie SameSite is not copied (@johejo) | ||||||
| - [#445](https://github.com/pusher/oauth2_proxy/pull/445) Expose `acr_values` to all providers (@holyjak) | - [#445](https://github.com/pusher/oauth2_proxy/pull/445) Expose `acr_values` to all providers (@holyjak) | ||||||
| - [#419](https://github.com/pusher/oauth2_proxy/pull/419) Support Go 1.14, upgrade dependencies, upgrade golangci-lint to 1.23.6 (@johejo) | - [#419](https://github.com/pusher/oauth2_proxy/pull/419) Support Go 1.14, upgrade dependencies, upgrade golangci-lint to 1.23.6 (@johejo) | ||||||
| - [#444](https://github.com/pusher/oauth2_proxy/pull/444) Support prompt in addition to approval-prompt (@holyjak) | - [#444](https://github.com/pusher/oauth2_proxy/pull/444) Support prompt in addition to approval-prompt (@holyjak) | ||||||
|  |  | ||||||
|  | @ -207,5 +207,6 @@ func copyCookie(c *http.Cookie) *http.Cookie { | ||||||
| 		HttpOnly:   c.HttpOnly, | 		HttpOnly:   c.HttpOnly, | ||||||
| 		Raw:        c.Raw, | 		Raw:        c.Raw, | ||||||
| 		Unparsed:   c.Unparsed, | 		Unparsed:   c.Unparsed, | ||||||
|  | 		SameSite:   c.SameSite, | ||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -0,0 +1,30 @@ | ||||||
|  | package cookie | ||||||
|  | 
 | ||||||
|  | import ( | ||||||
|  | 	"net/http" | ||||||
|  | 	"testing" | ||||||
|  | 	"time" | ||||||
|  | 
 | ||||||
|  | 	"github.com/stretchr/testify/assert" | ||||||
|  | ) | ||||||
|  | 
 | ||||||
|  | func Test_copyCookie(t *testing.T) { | ||||||
|  | 	expire, _ := time.Parse(time.RFC3339, "2020-03-17T00:00:00Z") | ||||||
|  | 	c := &http.Cookie{ | ||||||
|  | 		Name:       "name", | ||||||
|  | 		Value:      "value", | ||||||
|  | 		Path:       "/path", | ||||||
|  | 		Domain:     "x.y.z", | ||||||
|  | 		Expires:    expire, | ||||||
|  | 		RawExpires: "rawExpire", | ||||||
|  | 		MaxAge:     1, | ||||||
|  | 		Secure:     true, | ||||||
|  | 		HttpOnly:   true, | ||||||
|  | 		Raw:        "raw", | ||||||
|  | 		Unparsed:   []string{"unparsed"}, | ||||||
|  | 		SameSite:   http.SameSiteLaxMode, | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	got := copyCookie(c) | ||||||
|  | 	assert.Equal(t, c, got) | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue