Commit Graph

7 Commits

Author SHA1 Message Date
Conrad Hoffmann
ac9af45270 Dedicated type for conditional match header fields
The `If-Match` and `If-None-Match` conditional headers can have either a
wildcard or a (quoted) ETag as value. However, the ETag _could_ be a
literal `*`, so care must be taken to allow these cases to be
distinguished. The values of these headers have to be handled by the
backend, so export a type that facilitates working with these values.
2022-11-22 11:58:13 +01:00
Conrad Hoffmann
6887b6b812 Support custom user principal and home set paths
Currently, the user principal path and the home set path are both
hardcoded to "/", for both CalDAV and CardDAV. This poses a challenge if
one wishes to run a CardDAV and CalDAV server in the same server.

This commit introduces the concept of a UserPrincipalBackend. This
backend must provide the path of the current user's principal URL from
the given request context.

The CalDAV and CardDAV backends are extended to also function as
UserPrincipalBackend. In addition, they are required to supply the path
of the respective home set (`calendar-home-set` and
`addressbook-home-set`). The CardDAV and CalDAV servers act accordingly.

The individual servers will continue to work as before (including the
option of keeping everything at "/"). If one wishes to run CardDAV and
CalDAV in parallel, the new `webdav.ServeUserPrincipal()` can be used as
a convenience function to serve a common user principal URL for both
servers. The input for this function can be easily computed by the
application by getting the home set paths from the backends and using
`caldav.NewCalendarHomeSet()` and `carddav.NewAddressbookHomeSet()` to
create the home sets.

Note that the storage backend will have to know about these paths as
well. For any non-trivial use case, a storage backend should probably
have access to the same UserPrincipalBackend. That is, however, an
implementation detail and doesn't have to be reflected in the
interfaces.
2022-05-11 11:12:04 +02:00
Simon Ser
3a61646ab4
carddav: add current-user-principal to server 2020-01-20 10:56:25 +01:00
Simon Ser
9dfabd89c8
carddav: add Client.FindAddressBooks 2020-01-14 23:13:23 +01:00
Simon Ser
3d05533a31
carddav: add very basic Client 2020-01-14 22:19:54 +01:00
Simon Ser
5748fec4d0
internal: add helpers to parse multistatus 2020-01-14 21:29:54 +01:00
Simon Ser
3beb076950
webdav: add very basic Client 2020-01-14 18:51:17 +01:00