zitadel/internal/api/grpc
Livio Spring 3d071fc505
feat: trusted (instance) domains (#8369)
# Which Problems Are Solved

ZITADEL currently selects the instance context based on a HTTP header
(see https://github.com/zitadel/zitadel/issues/8279#issue-2399959845 and
checks it against the list of instance domains. Let's call it instance
or API domain.
For any context based URL (e.g. OAuth, OIDC, SAML endpoints, links in
emails, ...) the requested domain (instance domain) will be used. Let's
call it the public domain.
In cases of proxied setups, all exposed domains (public domains) require
the domain to be managed as instance domain.
This can either be done using the "ExternalDomain" in the runtime config
or via system API, which requires a validation through CustomerPortal on
zitadel.cloud.

# How the Problems Are Solved

- Two new headers / header list are added:
- `InstanceHostHeaders`: an ordered list (first sent wins), which will
be used to match the instance.
(For backward compatibility: the `HTTP1HostHeader`, `HTTP2HostHeader`
and `forwarded`, `x-forwarded-for`, `x-forwarded-host` are checked
afterwards as well)
- `PublicHostHeaders`: an ordered list (first sent wins), which will be
used as public host / domain. This will be checked against a list of
trusted domains on the instance.
- The middleware intercepts all requests to the API and passes a
`DomainCtx` object with the hosts and protocol into the context
(previously only a computed `origin` was passed)
- HTTP / GRPC server do not longer try to match the headers to instances
themself, but use the passed `http.DomainContext` in their interceptors.
- The `RequestedHost` and `RequestedDomain` from authz.Instance are
removed in favor of the `http.DomainContext`
- When authenticating to or signing out from Console UI, the current
`http.DomainContext(ctx).Origin` (already checked by instance
interceptor for validity) is used to compute and dynamically add a
`redirect_uri` and `post_logout_redirect_uri`.
- Gateway passes all configured host headers (previously only did
`x-zitadel-*`)
- Admin API allows to manage trusted domain

# Additional Changes

None

# Additional Context

- part of #8279 
- open topics: 
  - "single-instance" mode
  - Console UI
2024-07-31 18:00:38 +03:00
..
action feat(v3alpha): write actions (#8225) 2024-07-31 14:42:12 +02:00
admin feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
auth feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
authn chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
change refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
client/middleware refactor(fmt): run gci on complete project (#7557) 2024-04-03 10:43:43 +00:00
event refactor: rename package errors to zerrors (#7039) 2023-12-08 15:30:55 +01:00
feature feat: api v2beta to api v2 (#8283) 2024-07-26 22:39:55 +02:00
gerrors fix: exclude db connection error details (#7785) 2024-04-23 08:35:25 +00:00
idp feat(saml): allow setting nameid-format and alternative mapping for transient format (#7979) 2024-05-23 05:04:07 +00:00
instance feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
management feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
member refactor: cleanup unused code (#7130) 2024-01-02 14:26:31 +00:00
metadata fix(api): correct mapping of metadata queries (#7609) 2024-03-21 14:56:58 +00:00
object feat: api v2beta to api v2 (#8283) 2024-07-26 22:39:55 +02:00
oidc feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
org feat: api v2beta to api v2 (#8283) 2024-07-26 22:39:55 +02:00
policy feat(cnsl): docs link can be customized and custom button is available (#7840) 2024-05-13 16:01:50 +02:00
project feat(oidc): token exchange impersonation (#7516) 2024-03-20 10:18:46 +00:00
resources feat(v3alpha): write actions (#8225) 2024-07-31 14:42:12 +02:00
server feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
session feat: api v2beta to api v2 (#8283) 2024-07-26 22:39:55 +02:00
settings feat: trusted (instance) domains (#8369) 2024-07-31 18:00:38 +03:00
system fix: consider oidc session events for authN milestones (#8089) 2024-06-12 06:49:14 +02:00
text feat: password age policy (#8132) 2024-06-18 11:27:44 +00:00
user feat: api v2beta to api v2 (#8283) 2024-07-26 22:39:55 +02:00
config.go remove pointers on configs 2020-03-27 13:57:16 +01:00
fields.go fix: provide more information in the retrieve idp information (#5927) 2023-06-20 14:39:50 +02:00
header_test.go remove negated integration tags 2023-04-26 19:55:13 +03:00
header.go chore(v2): move to new org (#3499) 2022-04-26 23:01:45 +00:00
probes_test.go add server reflection to Probes list 2023-05-07 16:47:43 +02:00
probes.go add server reflection to Probes list 2023-05-07 16:47:43 +02:00