Skip to content

Commit

Permalink
Merge pull request #880 from Justin-Holmes/jholmes/fix-http-only-attr
Browse files Browse the repository at this point in the history
Fix inability to set http_only_cookie_attribute to false
  • Loading branch information
jacobbednarz committed May 12, 2022
2 parents 41d9f73 + 3edf698 commit fcb3cd4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
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
40 changes: 21 additions & 19 deletions access_application_test.go
Expand Up @@ -74,7 +74,7 @@ func TestAccessApplications(t *testing.T) {
CustomDenyMessage: "denied!",
CustomDenyURL: "https://www.example.com",
SameSiteCookieAttribute: "strict",
HttpOnlyCookieAttribute: true,
HttpOnlyCookieAttribute: BoolPtr(true),
LogoURL: "https://www.example.com/example.png",
SkipInterstitial: true,
}}
Expand Down Expand Up @@ -124,7 +124,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 @@ -134,23 +135,24 @@ func TestAccessApplication(t *testing.T) {
updatedAt, _ := time.Parse(time.RFC3339, "2014-01-01T05:20:00.12345Z")

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: BoolPtr(false),
}

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

0 comments on commit fcb3cd4

Please sign in to comment.