Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inability to set http_only_cookie_attribute to false #880

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion access_application.go
Expand Up @@ -44,7 +44,7 @@ type AccessApplication struct {
SkipInterstitial bool `json:"skip_interstitial,omitempty"`
AppLauncherVisible bool `json:"app_launcher_visible,omitempty"`
EnableBindingCookie bool `json:"enable_binding_cookie,omitempty"`
HttpOnlyCookieAttribute bool `json:"http_only_cookie_attribute,omitempty"`
HttpOnlyCookieAttribute *bool `json:"http_only_cookie_attribute,omitempty"`
ServiceAuth401Redirect bool `json:"service_auth_401_redirect,omitempty"`
}

Expand Down
42 changes: 23 additions & 19 deletions access_application_test.go
Expand Up @@ -57,6 +57,7 @@ func TestAccessApplications(t *testing.T) {
createdAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")

httpOnlyVal := true
want := []AccessApplication{{
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
CreatedAt: &createdAt,
Expand All @@ -74,7 +75,7 @@ func TestAccessApplications(t *testing.T) {
CustomDenyMessage: "denied!",
CustomDenyURL: "https://www.example.com",
SameSiteCookieAttribute: "strict",
HttpOnlyCookieAttribute: true,
HttpOnlyCookieAttribute: &httpOnlyVal,
Justin-Holmes marked this conversation as resolved.
Show resolved Hide resolved
LogoURL: "https://www.example.com/example.png",
SkipInterstitial: true,
}}
Expand Down Expand Up @@ -124,7 +125,8 @@ func TestAccessApplication(t *testing.T) {
"logo_url": "https://www.example.com/example.png",
"skip_interstitial": true,
"app_launcher_visible": true,
"service_auth_401_redirect": true
"service_auth_401_redirect": true,
"http_only_cookie_attribute": false
}
}
`)
Expand All @@ -133,24 +135,26 @@ func TestAccessApplication(t *testing.T) {
createdAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")
updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")

httpOnlyVal := false
want := AccessApplication{
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
AUD: "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
Name: "Admin Site",
Domain: "test.example.com/admin",
Type: "self_hosted",
SessionDuration: "24h",
AllowedIdps: []string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
AutoRedirectToIdentity: false,
EnableBindingCookie: false,
AppLauncherVisible: true,
ServiceAuth401Redirect: true,
CustomDenyMessage: "denied!",
CustomDenyURL: "https://www.example.com",
LogoURL: "https://www.example.com/example.png",
SkipInterstitial: true,
ID: "480f4f69-1a28-4fdd-9240-1ed29f0ac1db",
CreatedAt: &createdAt,
UpdatedAt: &updatedAt,
AUD: "737646a56ab1df6ec9bddc7e5ca84eaf3b0768850f3ffb5d74f1534911fe3893",
Name: "Admin Site",
Domain: "test.example.com/admin",
Type: "self_hosted",
SessionDuration: "24h",
AllowedIdps: []string{"f174e90a-fafe-4643-bbbc-4a0ed4fc8415"},
AutoRedirectToIdentity: false,
EnableBindingCookie: false,
AppLauncherVisible: true,
ServiceAuth401Redirect: true,
CustomDenyMessage: "denied!",
CustomDenyURL: "https://www.example.com",
LogoURL: "https://www.example.com/example.png",
SkipInterstitial: true,
HttpOnlyCookieAttribute: &httpOnlyVal,
Justin-Holmes marked this conversation as resolved.
Show resolved Hide resolved
}

mux.HandleFunc("/accounts/"+testAccountID+"/access/apps/480f4f69-1a28-4fdd-9240-1ed29f0ac1db", handler)
Expand Down