Class DefaultAuthenticationChallengeHandler

  • All Implemented Interfaces:
    AuthenticationChallengeHandler

    public class DefaultAuthenticationChallengeHandler
    extends java.lang.Object
    implements AuthenticationChallengeHandler
    Default implementation of the AuthenticationChallengeHandler interface to handle all security types that ArcGIS supports (including OAuth). This should be set on the AuthenticationManager by calling AuthenticationManager.setAuthenticationChallengeHandler(AuthenticationChallengeHandler).
    • If the challenge is an HTTP or token based authentication error, a dialog will prompt the user to enter their credentials.
    • If the challenge is an OAuth based authentication error, an OAuth login page will be launched. By default the login page will be launched using Chrome Custom Tabs. Alternatively, the OAuth page can be opened in the default browser by setting setChromeCustomTabsEnabled(boolean) to false.
      There are two additional steps to make OAuth work correctly in your app:
      1. Add an OAuth configuration to the AuthenticationManager with AuthenticationManager.addOAuthConfiguration(OAuthConfiguration),
      2. Handle the apps redirect URI with the DefaultOAuthIntentReceiver
    • If the challenge is a self signed certificate error, a dialog will prompt the user to indicate if they want to trust the certificate, as well as if they want the answer to be remembered.
    • If the challenge is a missing client certificate, then a dialog will prompt the user to select a suitable certificate file from the device.
    Since:
    100.0.0
    • Constructor Summary

      Constructors 
      Constructor Description
      DefaultAuthenticationChallengeHandler​(android.app.Activity context)
      Constructs a default AuthenticationChallengeHandler, which will use the provided activity for displaying dialogs that allow the user to respond to authentication challenges.
    • Constructor Detail

      • DefaultAuthenticationChallengeHandler

        public DefaultAuthenticationChallengeHandler​(android.app.Activity context)
        Constructs a default AuthenticationChallengeHandler, which will use the provided activity for displaying dialogs that allow the user to respond to authentication challenges.
        Parameters:
        context - the foreground activity, used for displaying the dialogs
        Since:
        100.0.0
    • Method Detail

      • handleChallenge

        public AuthenticationChallengeResponse handleChallenge​(AuthenticationChallenge challenge)
        Default implementation for handling authentication challenges. Determines the error type and takes the respective action (prompting for credentials if needed, asking to trust server, setup client certificate store, etc.)
        Specified by:
        handleChallenge in interface AuthenticationChallengeHandler
        Parameters:
        challenge - the authentication challenge to handle
        Returns:
        the AuthenticationChallengeResponse indicating which action to take
        Since:
        100.0.0
      • isChromeCustomTabsEnabled

        public static boolean isChromeCustomTabsEnabled()
        Returns whether the DefaultAuthenticationChallengeHandler uses Chrome Custom Tabs to launch the OAuth login page. Chrome Custom Tabs are enabled by default.
        Returns:
        true if Chrome Custom Tabs are enabled, false otherwise
        Since:
        100.7.0
      • setChromeCustomTabsEnabled

        public static void setChromeCustomTabsEnabled​(boolean chromeCustomTabsEnabled)
        Set whether the DefaultAuthenticationChallengeHandler uses Chrome Custom Tabs to launch the OAuth login page. Chrome Custom Tabs are enabled by default.
        Parameters:
        chromeCustomTabsEnabled - true to enable Chrome Custom Tabs, false otherwise
        Since:
        100.7.0
      • setChromeCustomTabsToolbarColor

        public static void setChromeCustomTabsToolbarColor​(java.lang.Integer toolbarColor)
        Sets the Chrome Custom Tabs toolbar color to an ARGB(alpha, red, green, blue) value. The default value is null, which means no value has been set and the system's default toolbar color will be applied.
        Parameters:
        toolbarColor - an integer representing the color property as 0xAARRGGBB or null to use the systems's default color
        Since:
        100.7.0
      • getChromeCustomTabsToolbarColor

        public static java.lang.Integer getChromeCustomTabsToolbarColor()
        Gets the Chrome Custom Tabs toolbar color as an ARGB(alpha, red, green, blue) value. The default value is null, which means no value has been set and the system's default toolbar color will be applied.
        Returns:
        an integer representing the color property as 0xAARRGGBB or null if using the system's default color
        Since:
        100.7.0