Enable Split Cookies (#318)

This commit is contained in:
Todd Knight authored and GitHub committed 2020-09-01 09:23:41 -07:00
1 parent a4c20164f3
commit 0aba6db720
11 files changed
+174 -49

No files matched your search

+7 -6
View File
@@ -12,6 +12,7 @@ import (
"github.com/hashicorp/boundary/internal/iam"
"github.com/hashicorp/boundary/internal/kms"
"github.com/hashicorp/boundary/internal/servers"
"github.com/hashicorp/boundary/internal/servers/controller/handlers"
"github.com/hashicorp/boundary/internal/types/action"
"github.com/hashicorp/boundary/internal/types/resource"
"github.com/hashicorp/go-hclog"
@@ -317,8 +318,8 @@ func TestAuthTokenAuthenticator(t *testing.T) {
{
name: "Split cookie token",
cookies: []http.Cookie{
{Name: HttpOnlyCookieName, Value: httpCookieVal},
{Name: JsVisibleCookieName, Value: jsCookieVal},
{Name: handlers.HttpOnlyCookieName, Value: httpCookieVal},
{Name: handlers.JsVisibleCookieName, Value: jsCookieVal},
},
userId: at.GetIamUserId(),
tokenFormat: AuthTokenTypeSplitCookie,
@@ -326,14 +327,14 @@ func TestAuthTokenAuthenticator(t *testing.T) {
{
name: "Split cookie token only http cookie",
cookies: []http.Cookie{
{Name: HttpOnlyCookieName, Value: httpCookieVal},
{Name: handlers.HttpOnlyCookieName, Value: httpCookieVal},
},
tokenFormat: AuthTokenTypeUnknown,
},
{
name: "Split cookie token only js cookie",
cookies: []http.Cookie{
{Name: JsVisibleCookieName, Value: jsCookieVal},
{Name: handlers.JsVisibleCookieName, Value: jsCookieVal},
},
tokenFormat: AuthTokenTypeUnknown,
},
@@ -341,8 +342,8 @@ func TestAuthTokenAuthenticator(t *testing.T) {
name: "Cookie and auth header",
headers: map[string]string{"Authorization": fmt.Sprintf("Bearer %s", tokValue)},
cookies: []http.Cookie{
{Name: HttpOnlyCookieName, Value: httpCookieVal},
{Name: JsVisibleCookieName, Value: jsCookieVal},
{Name: handlers.HttpOnlyCookieName, Value: httpCookieVal},
{Name: handlers.JsVisibleCookieName, Value: jsCookieVal},
},
userId: at.GetIamUserId(),
tokenFormat: AuthTokenTypeBearer,