Merge branch 'next' into next-rc

# Conflicts:
#	internal/auth/repository/eventsourcing/eventstore/auth_request_test.go
#	proto/zitadel/resources/action/v3alpha/action_service.proto
This commit is contained in:
Livio Spring 2024-08-29 06:46:06 +02:00
commit b93fa831c8
No known key found for this signature in database
GPG Key ID: 26BB1C2FA5952CF0
5 changed files with 29 additions and 24 deletions

View File

@ -23,6 +23,7 @@ const (
ForwardedHost = "x-forwarded-host" ForwardedHost = "x-forwarded-host"
ForwardedProto = "x-forwarded-proto" ForwardedProto = "x-forwarded-proto"
Forwarded = "forwarded" Forwarded = "forwarded"
ZitadelForwarded = "x-zitadel-forwarded"
XUserAgent = "x-user-agent" XUserAgent = "x-user-agent"
XGrpcWeb = "x-grpc-web" XGrpcWeb = "x-grpc-web"
XRequestedWith = "x-requested-with" XRequestedWith = "x-requested-with"

View File

@ -17,7 +17,7 @@ func WithOrigin(fallBackToHttps bool, http1Header, http2Header string, instanceH
r, r,
fallBackToHttps, fallBackToHttps,
// to make sure we don't break existing configurations we append the existing checked headers as well // to make sure we don't break existing configurations we append the existing checked headers as well
slices.Compact(append(instanceHostHeaders, http1Header, http2Header, http_util.Forwarded, http_util.ForwardedFor, http_util.ForwardedHost, http_util.ForwardedProto)), slices.Compact(append(instanceHostHeaders, http1Header, http2Header, http_util.Forwarded, http_util.ZitadelForwarded, http_util.ForwardedFor, http_util.ForwardedHost, http_util.ForwardedProto)),
publicDomainHeaders, publicDomainHeaders,
) )
next.ServeHTTP(w, r.WithContext(http_util.WithDomainContext(r.Context(), origin))) next.ServeHTTP(w, r.WithContext(http_util.WithDomainContext(r.Context(), origin)))
@ -52,7 +52,8 @@ func hostFromRequest(r *http.Request, headers []string) (host, proto string) {
for _, header := range headers { for _, header := range headers {
switch http.CanonicalHeaderKey(header) { switch http.CanonicalHeaderKey(header) {
case http.CanonicalHeaderKey(http_util.Forwarded), case http.CanonicalHeaderKey(http_util.Forwarded),
http.CanonicalHeaderKey(http_util.ForwardedFor): http.CanonicalHeaderKey(http_util.ForwardedFor),
http.CanonicalHeaderKey(http_util.ZitadelForwarded):
hostFromHeader, protoFromHeader = hostFromForwarded(r.Header.Values(header)) hostFromHeader, protoFromHeader = hostFromForwarded(r.Header.Values(header))
case http.CanonicalHeaderKey(http_util.ForwardedHost): case http.CanonicalHeaderKey(http_util.ForwardedHost):
hostFromHeader = r.Header.Get(header) hostFromHeader = r.Header.Get(header)

View File

@ -2604,6 +2604,7 @@ func TestAuthRequestRepo_VerifyPassword_IgnoreUnknownUsernames(t *testing.T) {
a.SetPolicyOrgID("instance1") a.SetPolicyOrgID("instance1")
return a return a
} }
type fields struct { type fields struct {
AuthRequests func(*testing.T, string) cache.AuthRequestCache AuthRequests func(*testing.T, string) cache.AuthRequestCache
UserViewProvider userViewProvider UserViewProvider userViewProvider

View File

@ -109,6 +109,7 @@ func AssertResourceListDetails[D ResourceListDetailsMsg](t testing.TB, expected,
assert.Nil(t, gotDetails) assert.Nil(t, gotDetails)
return return
} }
assert.Equal(t, wantDetails.GetTotalResult(), gotDetails.GetTotalResult()) assert.Equal(t, wantDetails.GetTotalResult(), gotDetails.GetTotalResult())
assert.Equal(t, wantDetails.GetAppliedLimit(), gotDetails.GetAppliedLimit()) assert.Equal(t, wantDetails.GetAppliedLimit(), gotDetails.GetAppliedLimit())

View File

@ -8,6 +8,7 @@ import "google/protobuf/duration.proto";
import "google/protobuf/struct.proto"; import "google/protobuf/struct.proto";
import "protoc-gen-openapiv2/options/annotations.proto"; import "protoc-gen-openapiv2/options/annotations.proto";
import "validate/validate.proto"; import "validate/validate.proto";
import "zitadel/protoc_gen_zitadel/v2/options.proto"; import "zitadel/protoc_gen_zitadel/v2/options.proto";
import "zitadel/resources/action/v3alpha/target.proto"; import "zitadel/resources/action/v3alpha/target.proto";