Class AuthenticationChallenge


  • public final class AuthenticationChallenge
    extends Object
    Represents an authentication challenge that is presented upon encountering an authentication error. The class contains pertinent information, such as the exception that was raised, the service that was being requested, the credentials used to access them. The challenge will be issued to the current challenge handler, if one has been provided by setting AuthenticationManager.setAuthenticationChallengeHandler(AuthenticationChallengeHandler).

    In Android, a DefaultAuthenticationChallengeHandler is provided for this purpose; if set as the current challenge handler, it will prompt the user for the required information (such as credentials, or whether to trust a server certificate) and then return that information for the request to be retried. The request may also be canceled.

    Since:
    100.0.0
    • Method Detail

      • getFailureCount

        public int getFailureCount()
        Gets the number of times that the request issuing this challenge has already failed.
        Returns:
        the number of times this request has failed
        Since:
        100.0.0
      • getException

        public IOException getException()
        Gets the original authentication exception that was raised by the request.
        Returns:
        the original authentication exception
        Since:
        100.0.0
      • getRemoteResource

        public RemoteResource getRemoteResource()
        Gets the RemoteResource that was used to initiate the request.
        Returns:
        the RemoteResource that initiated the request
        Since:
        100.0.0
      • getType

        public AuthenticationChallenge.Type getType()
        Gets the type of the authentication challenge.
        Returns:
        the type of the challenge
        Since:
        100.0.0
      • getRemoteResourceOwningSystemUrl

        public String getRemoteResourceOwningSystemUrl()
        Returns the owning system URL of the server on which the RemoteResource is running, which can be used to determine if the server is federated by a portal.
        Returns:
        the owning system URL of the RemoteResource
        Since:
        100.0.0
      • isRemoteResourceFederated

        public boolean isRemoteResourceFederated()
        Returns true if the server the RemoteResource runs on is federated to a portal.
        Returns:
        true if the server is federated, else false
        Since:
        100.0.0