|
YAACC - UPNP Client and Server
|
Decides whether a request to the media proxy may be served, from the remote address alone. More...

Static Public Member Functions | |
| static boolean | isAllowed (boolean restrictToReceivers, Set< String > allowedAddresses, String remoteAddress) |
| static String | normalize (String address) |
| Brings an IP literal into the one form used for comparing: | |
| static Set< String > | normalizeAll (Collection< String > rawAddresses) |
| Builds a ready-to-use allowed set from raw address texts (e.g. | |
Decides whether a request to the media proxy may be served, from the remote address alone.
Plain Java so it can be unit tested on the JVM. The key and the expiry are checked elsewhere (ShareRegistry#lookup(String)); this is only the IP step.
With restrictToReceivers off every remote address passes this step (even a missing one). With it on, the remote address must equal one of the entry's allowed addresses after normalize(String); anything unclear is denied (fail closed). Loopback is not special: it passes only if the set contains it (the caller adds loopback and the own address when the receiver is the local device). Names are never resolved, networks and wildcards never match.
Both sides are normalized before comparing: the remote address AND every element of the allowed set, so the glue may add raw strings (mapped IPv6 vs IPv4, upper case, zone ids, whitespace); elements that do not normalize to an IP literal are ignored (they never match).
|
static |
| restrictToReceivers | the "Restrict the media proxy to the chosen receivers" setting |
| allowedAddresses | the entry's allowed receiver addresses, may be null (denies when restricting) |
| remoteAddress | the request's remote address as text, may be null |

|
static |
Brings an IP literal into the one form used for comparing:
%wlan0) are removed; :: compression, e.g. ::1 becomes 0:0:0:0:0:0:0:1; ::ffff:192.168.1.5 or ::ffff:c0a8:105) becomes the plain IPv4 text; the deprecated IPv4-compatible form (::192.168.1.5) is NOT mapped. Referenced by de.yaacc.share.ProxyAccessPolicy.isAllowed().

|
static |
Builds a ready-to-use allowed set from raw address texts (e.g.
a URL host or InetAddress#getHostAddress()): for each element surrounding whitespace is removed, then ONE pair of surrounding brackets ([::1], as in a URL host) is stripped, then normalize(String) is applied. Elements that are null or do not normalize to an IP literal (host names, garbage, [[::1]], a bracket pair around an IPv4 address with a zone, ...) are dropped; duplicates collapse.
isAllowed(boolean, Set, String) itself does NOT strip brackets (it only normalizes, so a bracketed element of a raw set never matches): the glue passes its raw texts through this method first.
| rawAddresses | may be null |
Referenced by de.yaacc.share.ShareAddresses.build(), and de.yaacc.share.LinkTargetPolicy.isAllowedTarget().
