UAWhitelist

@interface UAWhitelist : NSObject

Class for whitelisting and verifying webview URLs.

Whitelist entries are written as URL patterns with optional wildcard matching:

 \<scheme\> := \<any char combination, '\*' are treated as wildcards\>

 \<host\> := '\*' | '\*.'\<any char combination except '/' and '\*'\> | \<any char combination except '/' and '\*'\>

 \<path\> := \<any char combination, '\*' are treated as wildcards\>

 \<pattern\> := '\*' | \<scheme\>://\<host\>\<path\> | \<scheme\>://\<host\> | \<scheme\>:/\<path\> | \<scheme\>:///\<path\>

A single wildcard will match any URI. Wildcards in the scheme pattern will match any characters, and a single wildcard in the scheme will match any scheme. The wildcard in a host pattern *.mydomain.com will match anything within the mydomain.com domain. Wildcards in the path pattern will match any characters, including subdirectories.

Note that NSURL does not support internationalized domains containing non-ASCII characters. All whitelist entries for internationalized domains must be in ASCII IDNA format as specified in https://tools.ietf.org/html/rfc3490

  • Enables or disables whitelist checks at the scope UAWhitelistScopeOpenURL. If disabled, all whitelist checks for this scope will be allowed.

    Declaration

    Objective-C

    @property (getter=isOpenURLWhitelistingEnabled, assign, readwrite, nonatomic)
        BOOL openURLWhitelistingEnabled;

    Swift

    var isOpenURLWhitelistingEnabled: Bool { get set }
  • The whitelist delegate. NOTE: The delegate is not retained.

    Declaration

    Objective-C

    @property (readwrite, nonatomic, nullable) id<UAWhitelistDelegate> delegate;

    Swift

    weak var delegate: UAWhitelistDelegate? { get set }
  • Create a default whitelist with entries specified in a config object.

    Note

    The entry *.urbanairship.com is added by default.

    Declaration

    Objective-C

    + (nonnull instancetype)whitelistWithConfig:(nonnull UARuntimeConfig *)config;

    Swift

    convenience init(config: UARuntimeConfig)

    Parameters

    config

    An instance of UARuntimeConfig.

    Return Value

    An instance of UAWhitelist

  • Add an entry to the whitelist, with the implicit scope UAWhitelistScopeAll.

    Declaration

    Objective-C

    - (BOOL)addEntry:(nonnull NSString *)patternString;

    Swift

    func addEntry(_ patternString: String) -> Bool

    Parameters

    patternString

    A whitelist pattern string.

    Return Value

    YES if the whitelist pattern was validated and added, NO otherwise.

  • Add an entry to the whitelist.

    Declaration

    Objective-C

    - (BOOL)addEntry:(nonnull NSString *)patternString
               scope:(UAWhitelistScope)scope;

    Swift

    func addEntry(_ patternString: String, scope: UAWhitelistScope) -> Bool

    Parameters

    patternString

    A whitelist pattern string.

    scope

    The scope of the pattern.

    Return Value

    YES if the whitelist pattern was validated and added, NO otherwise.

  • Determines whether a given URL is whitelisted, with the implicit scope UAWhitelistScopeAll.

    Declaration

    Objective-C

    - (BOOL)isWhitelisted:(nonnull NSURL *)url;

    Swift

    func isWhitelisted(_ url: URL) -> Bool

    Parameters

    url

    The URL under consideration.

    Return Value

    YES if the the URL is whitelisted, NO otherwise.

  • Determines whether a given URL is whitelisted.

    Declaration

    Objective-C

    - (BOOL)isWhitelisted:(nonnull NSURL *)url scope:(UAWhitelistScope)scope;

    Swift

    func isWhitelisted(_ url: URL, scope: UAWhitelistScope) -> Bool

    Parameters

    url

    The URL under consideration.

    scope

    The scope of the desired match.

    Return Value

    YES if the the URL is whitelisted, NO otherwise.