Class OAuthConfiguration

java.lang.Object
com.esri.arcgisruntime.security.OAuthConfiguration

public final class OAuthConfiguration extends Object
Represents a configuration for OAuth access information used by the DefaultAuthenticationChallengeHandler and set on the AuthenticationManager. The client ID and redirect URI will be used when accessing the specified portal URL. If the specified portal URL is null, then the client ID and redirect URI will be used for all portals. Multiple OAuthConfigurations can be added to the AuthenticationManager, each for a separate portal.

The client ID, along with the redirect URI, will be used to show an OAuth login page on a device-installed browser. Applications on different portals will require a unique client ID for each portal.

The redirect URI must be registered to your application in your portal.

Note: It is only required to set OAuthConfigurations on the AuthenticationManager when you are using the DefaultAuthenticationChallengeHandler; it is not needed when you are doing custom OAuth workflows using the OAuthLoginManager.

Since:
100.0.0
See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    OAuthConfiguration(String portalUrl, String clientId, String redirectUri)
    Constructs an OAuthConfiguration with the specified portal URL, client ID, and redirect URI.
    OAuthConfiguration(String portalUrl, String clientId, String redirectUri, int expiration)
    Constructs an OAuthConfiguration with the specified portal URL, client ID, redirect URI and the expiration time for the refresh token.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the client ID to use for this portal URL.
    Gets the culture code corresponding to the language to be used on the OAuth login page.
    int
    Gets the expiration interval (in minutes) of the refresh token generated by the OAuth request.
    Gets the portal URL for which to use this OAuthConfiguration.
    Gets the redirect URI to use for this portal URL.
    void
    setCulture(String culture)
    Sets the culture code corresponding to the language to be used on the OAuth login page.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OAuthConfiguration

      public OAuthConfiguration(String portalUrl, String clientId, String redirectUri) throws MalformedURLException
      Constructs an OAuthConfiguration with the specified portal URL, client ID, and redirect URI. Portal URL may be null to specify that the client ID and redirect URI should be used for all portals, but client ID cannot be null.
      Parameters:
      portalUrl - the portal URL for which to use this client ID and redirect URI, or null to use for all portals
      clientId - the client ID to use for the portal
      redirectUri - the redirect URI to use for the portal
      Throws:
      IllegalArgumentException - if clientId is null
      MalformedURLException - if the portal URL is non-null and malformed
      Since:
      100.0.0
    • OAuthConfiguration

      public OAuthConfiguration(String portalUrl, String clientId, String redirectUri, int expiration) throws MalformedURLException
      Constructs an OAuthConfiguration with the specified portal URL, client ID, redirect URI and the expiration time for the refresh token. Portal URL may be null to specify that the client ID and redirect URI should be used for all portals, but client ID cannot be null.
      Parameters:
      portalUrl - the portal URL for which to use this client ID and redirect URI, or null to use for all portals
      clientId - the client ID to use for the portal
      redirectUri - the redirect URI to use for the portal
      expiration - the expiration of the refresh token in minutes. The refresh token can be valid for up to 90 days (129600 minutes) or the maximum limit set at the ArcGIS Online organisation level (whichever is minimum). Once the refresh token has expired, the user will have to log in again. For a permanent refresh token (if the portal supports it), use -1
      Throws:
      IllegalArgumentException - if clientId is null
      MalformedURLException - if the portal URL is non-null and malformed
      Since:
      100.5.0
  • Method Details

    • getPortalUrl

      public String getPortalUrl()
      Gets the portal URL for which to use this OAuthConfiguration.
      Returns:
      the portal URL
      Since:
      100.0.0
    • getClientId

      public String getClientId()
      Gets the client ID to use for this portal URL.
      Returns:
      the client ID
      Since:
      100.0.0
    • getRedirectUri

      public String getRedirectUri()
      Gets the redirect URI to use for this portal URL.
      Returns:
      the redirect URI
      Since:
      100.0.0
    • getExpiration

      public int getExpiration()
      Gets the expiration interval (in minutes) of the refresh token generated by the OAuth request. The max interval can be overridden by the portal administrator.

      If the expiration interval is not set, then the refresh token is valid for two weeks. If a -1 is passed as the fourth parameter of OAuthConfiguration(String, String, String, int), a permanent refresh Token is generated (if the portal supports permanent refresh tokens).

      Returns:
      the expiration interval of the refresh token in minutes. The value -1 indicates a permanent refresh token.
      Since:
      100.5.0
    • setCulture

      public void setCulture(String culture)
      Sets the culture code corresponding to the language to be used on the OAuth login page.

      The default culture is based on the current culture set on the device/machine. Set it to null if you want to see the OAuth login page in the language corresponding to the culture set in the portal/organization settings.

      The format for culture code is based on a language code and a country code separated by a hyphen. Example: "en-US". For the list of supported cultures see Supported Languages.

      If not explicitly set, the culture used by the device/machine is used. If the culture is not supported by the portal or set to null, OAuth login page will display in the language corresponding to culture specified in the portal/organization settings.

      Parameters:
      culture - the culture code to use, or null to see the OAuth login page in the language corresponding to the culture set in the portal/organization settings
      Since:
      100.9.0
    • getCulture

      public String getCulture()
      Gets the culture code corresponding to the language to be used on the OAuth login page.

      The default culture is based on the current culture set on the device/machine.

      The format for culture code is based on a language code and a country code separated by a dash. Example: "en-US". For the list of supported cultures see Supported Languages.

      Returns:
      the culture code currently in use, or null to use the culture set in the portal/organization settings
      Since:
      100.9.0