public interface UserAgent
An interface for representing user agent information.
Author:
Martin Lindström
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the "User-Agent" header received from when the user connected to the service.
    Returns the type of the device the user has, for example "mobile" or "desktop".
    Returns the IP address for the user.
    boolean
    Predicate that indicates if the "User-Agent" header indicates if the platform is iOS.
    boolean
    If the user uses an embedded browser in Facebook, Twitter or any other app, the BankID app will be blocked from starting since iOS requires an app to whitelist all URL-schemes that an app should be able to invoke.
    boolean
    Predicate that indicates if the "User-Agent" header indicates the Safari mobile web browser (not embedded in another app).
  • Method Details

    • getUserDeviceType

      UserDeviceType getUserDeviceType()
      Returns the type of the device the user has, for example "mobile" or "desktop".
      Returns:
      user device type
    • getUserAgentHeader

      String getUserAgentHeader()
      Returns the "User-Agent" header received from when the user connected to the service.
      Returns:
      the "User-Agent" header
    • getUserIpAddress

      String getUserIpAddress()
      Returns the IP address for the user.
      Returns:
      the IP address
    • is_iOS

      boolean is_iOS()
      Predicate that indicates if the "User-Agent" header indicates if the platform is iOS.
      Returns:
      if the "User-Agent" header indicates iOS true is returned, and otherwise false.
    • isNonEmbeddedMobileSafari

      boolean isNonEmbeddedMobileSafari()
      Predicate that indicates if the "User-Agent" header indicates the Safari mobile web browser (not embedded in another app).

      The reason that we need special handling of iOS and Safari is that the BankID app needs to be started with an extra parameter for those cases.

      Returns:
      true if the "User-Agent" header indicates that Safari is used and false otherwise
    • isEmbeddedBrowser

      boolean isEmbeddedBrowser()
      If the user uses an embedded browser in Facebook, Twitter or any other app, the BankID app will be blocked from starting since iOS requires an app to whitelist all URL-schemes that an app should be able to invoke. And BankID is pretty unknown to the major apps, so in those cases we need to ask the user to manually start the app. This predicate checks if the "User-Agent" header indicates that an embedded browser is in use.
      Returns:
      true if the "User-Agent" header indicates that an embedded browser is used and false otherwise