Skip to content

Commit

Permalink
Align struct fields in memory (#503)
Browse files Browse the repository at this point in the history
* Align struct fields in memory

* Fix linting

* Fix linting
  • Loading branch information
p53 authored Sep 10, 2024
1 parent 619f7ed commit 32e2492
Show file tree
Hide file tree
Showing 6 changed files with 306 additions and 591 deletions.
405 changes: 133 additions & 272 deletions pkg/google/config/config.go

Large diffs are not rendered by default.

428 changes: 141 additions & 287 deletions pkg/keycloak/config/config.go

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pkg/keycloak/proxy/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1020,19 +1020,19 @@ func (r *OauthProxy) Shutdown() error {

// listenerConfig encapsulate listener options
type listenerConfig struct {
hostnames []string // list of hostnames the service will respond to
ca string // the path to a certificate authority
certificate string // the path to the certificate if any
clientCert string // the path to a client certificate to use for mutual tls
hostnames []string // list of hostnames the service will respond to
letsEncryptCacheDir string // the path to cache letsencrypt certificates
listen string // the interface to bind the listener to
privateKey string // the path to the private key if any
proxyProtocol bool // whether to enable proxy protocol on the listen
redirectionURL string // url to redirect to
minTLSVersion uint16 // server minimal TLS version
proxyProtocol bool // whether to enable proxy protocol on the listen
useFileTLS bool // indicates we are using certificates from files
useLetsEncryptTLS bool // indicates we are using letsencrypt
useSelfSignedTLS bool // indicates we are using the self-signed tls
minTLSVersion uint16 // server minimal TLS version
}

// makeListenerConfig extracts a listener configuration from a proxy Config
Expand Down
6 changes: 3 additions & 3 deletions pkg/proxy/cookie/cookies.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ import (
type Manager struct {
CookieDomain string
BaseURI string
HTTPOnlyCookie bool
SecureCookie bool
EnableSessionCookies bool
SameSiteCookie string
CookieAccessName string
CookieRefreshName string
Expand All @@ -40,6 +37,9 @@ type Manager struct {
CookieUMAName string
CookieRequestURIName string
CookieOAuthStateName string
HTTPOnlyCookie bool
SecureCookie bool
EnableSessionCookies bool
NoProxy bool
NoRedirects bool
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/testsuite/fake_authserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ type fakeOidcDiscoveryResponse struct {
var letterRunes = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")

type fakeAuthConfig struct {
DiscoveryURLPrefix string
Expiration time.Duration
EnablePKCE bool
EnableTLS bool
EnableProxy bool
Expiration time.Duration
ResourceSetHandlerFailure bool
DiscoveryURLPrefix string
}

// newFakeAuthServer simulates a oauth service
Expand Down
48 changes: 24 additions & 24 deletions pkg/testsuite/fake_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,49 +30,49 @@ import (
)

type fakeRequest struct {
BasicAuth bool
Cookies []*http.Cookie
Expires time.Duration
FormValues map[string]string
Groups []string
HasCookieToken bool
HasLogin bool
LoginXforwarded bool
HasToken bool
Headers map[string]string
Roles []string
ExpectedNoProxyHeaders []string
Method string
NotSigned bool
OnResponse func(int, *resty.Request, *resty.Response)
Password string
ProxyProtocol string
ProxyRequest bool
RawToken string
Redirects bool
Roles []string
SkipClientIDCheck bool
SkipIssuerCheck bool
RequestCA string
TokenClaims map[string]interface{}
TokenAuthorization *models.Permissions
URI string
URL string
Username string
TLSMin uint16
TLSMax uint16
ExpectedCode int
ExpectedContent func(body string, testNum int)
ExpectedContentContains string
ExpectedRequestError string
ExpectedLocation string
Expires time.Duration
FormValues map[string]string
Headers map[string]string
OnResponse func(int, *resty.Request, *resty.Response)
TokenClaims map[string]interface{}
TokenAuthorization *models.Permissions
ExpectedCode int
ExpectedContent func(body string, testNum int)
ExpectedCookies map[string]string
ExpectedHeaders map[string]string
ExpectedHeadersValidator map[string]func(*testing.T, *config.Config, string)
ExpectedLocation string
ExpectedNoProxyHeaders []string
ExpectedProxy bool
ExpectedProxyHeaders map[string]string
ExpectedProxyHeadersValidator map[string]func(*testing.T, *config.Config, string)
ExpectedCookiesValidator map[string]func(*testing.T, *config.Config, string) bool
ExpectedLoginCookiesValidator map[string]func(*testing.T, *config.Config, string) bool
TLSMin uint16
TLSMax uint16
BasicAuth bool
HasCookieToken bool
HasLogin bool
LoginXforwarded bool
HasToken bool
NotSigned bool
ProxyRequest bool
Redirects bool
SkipClientIDCheck bool
SkipIssuerCheck bool
ExpectedProxy bool
}

type fakeProxy struct {
Expand Down

0 comments on commit 32e2492

Please sign in to comment.