Package org.exoplatform.agenda.util
Class CalendarAddressGuard
java.lang.Object
org.exoplatform.agenda.util.CalendarAddressGuard
Decides which calendar links the platform may be made to read (EXO-90278):
the platform's
SafeAddressGuard, with what is a calendar's own —
webcal:// and webcals:// read as https://, and each
refusal reported as the CalendarFeedException reason the user is
shown.
The rules themselves — http or https, no credentials, a port in the allowed set, and every internal address range refused unless the deployment allows internal addresses — are the shared guard's, applied once more by the HTTP client's own resolver when a connection opens, so that the address checked is the address dialled.
-
Constructor Summary
ConstructorsConstructorDescriptionCalendarAddressGuard(io.meeds.commons.http.SafeAddressGuard delegate) The guard over a shared guard: the fetcher's, so that the rules applied before a read are the ones its connections apply. -
Method Summary
Modifier and TypeMethodDescriptionReads a URL as the user typed it: trimmed,webcal://andwebcals://read ashttps://, then normalized and checked by the platform's guard.Reads a URL as the user typed it, asnormalize(String)does, but keeps a URL whose only fault is an internal address literal when it is read in the process, never over the network: a link of this eXo, whose public domain may well be an internal address.static Stringreason(io.meeds.commons.http.SafeFetchFailure failure) The reason a calendar link cannot be read, from why the platform's fetcher read nothing: the message code the user is shown.
-
Constructor Details
-
CalendarAddressGuard
public CalendarAddressGuard(io.meeds.commons.http.SafeAddressGuard delegate) The guard over a shared guard: the fetcher's, so that the rules applied before a read are the ones its connections apply.- Parameters:
delegate- the platform's guard
-
-
Method Details
-
normalize
Reads a URL as the user typed it: trimmed,webcal://andwebcals://read ashttps://, then normalized and checked by the platform's guard. Nothing is resolved here. The form for a URL that is only ever read over the network; the subscription service, which reads links of this eXo in the process, usesnormalize(String, Predicate).- Parameters:
url- the URL as typed- Returns:
- the URL to read
- Throws:
CalendarFeedException- with the reason it is refused
-
normalize
Reads a URL as the user typed it, asnormalize(String)does, but keeps a URL whose only fault is an internal address literal when it is read in the process, never over the network: a link of this eXo, whose public domain may well be an internal address. Every other rule still applies, since the platform's guard judges the literal last.- Parameters:
url- the URL as typedreadInProcess- whether a URL is read without any connection- Returns:
- the URL to read
- Throws:
CalendarFeedException- with the reason it is refused
-
reason
The reason a calendar link cannot be read, from why the platform's fetcher read nothing: the message code the user is shown.- Parameters:
failure- why nothing was read- Returns:
- the
CalendarFeedExceptionreason
-