mirror of
https://codeberg.org/forgejo/docs.git
synced 2024-11-29 18:52:48 -05:00
98dac9cb1f
Preview: * https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/federation-architecture/ * https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/threat-analysis/ * https://forgejo.codeberg.page/@docs_pull_639/docs/next/developer/adr/ Co-authored-by: patdyn <erik.seiert@meissa-gmbh.de> Co-authored-by: Clemens <clemens.geibel@meissa-gmbh.de.de> Reviewed-on: https://codeberg.org/forgejo/docs/pulls/639 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Reviewed-by: Panagiotis "Ivory" Vasilopoulos <git@n0toose.net> Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de> Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
1.9 KiB
1.9 KiB
title | license |
---|---|
Federation Architecture | CC-BY-SA-4.0 |
While implementing federation in Forgejo we introduced some concepts from DomainDrivenDesign:
- Aggregate: Aggregates are clusters of objects (entities or values) which are handled atomic when it comes to persistence.
- Validation: Every object should express it's own validity, whenever someone is interested in
- we collect as many invalidity information as possible in one shoot - so we return a list of validation issues if there are some.
- Objects entering the lifetime are checked for validity on the borders (after loaded from and before stored to DB, after being newly created (New* functions) or after loaded via web / REST).
Objects in forgefed package reflect Objects from ap or f3 lib but add some Forgejo specific enhancements like more specific validation.
Federation Model
Normalized URI used as ID
In order to use URIs as ID we've to normalize URIs.
A normalized user URI looks like: https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/1
In order to normalize URIs we care:
- Case (all to lower case):
https://federated-REPO.prod.meissa.de/api/v1/activitypub/user-id/1
- No relative path:
https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/../user-id/1
- No parameters:
https://federated-repo.prod.meissa.de/api/v1/activitypub/user-id/1?some-parameters=1
- No Webfinger:
https://user1@federated-repo.prod.meissa.de
(with following redirects) - No default api:
https://federated-repo.prod.meissa.de/api/activitypub/user-id/1
- No autorization:
https://user:password@federated-repo.prod.meissa.de/api/v1/activitypub/user-id/1
- No default ports:
https://federated-repo.prod.meissa.de:443/api/v1/activitypub/user-id/1
- Accept non default ports:
http://localhost:3000/api/v1/activitypub/user-id/1