Class AuthenticationManager
The Authentication Manager is a singleton class that, when enabled, will manage the user credentials.
Inheritance
Namespace: Esri.ArcGISRuntime.Security
Assembly: Esri.ArcGISRuntime.dll
Syntax
public sealed class AuthenticationManager
Remarks
This is for the following resources:
- ArcGIS Server resources secured using token-based authentication or using HTTP authentication. Note that only ArcGIS Server versions 10 SP 1 and greater are supported.
- Secured ArcGIS.com resources (e.g. web maps).
- Secured ArcGIS Portal resources.
A credential for accessing to an ArcGIS resource can be preset by using AddCredential(Credential). In this case the credential is used for any requests to the specified resources.
If a request to an ArcGIS resource returns an authorization error, the ChallengeHandler,
if not null
, is called. This challenge handler can return the credential for accessing to the
resource.
If the ChallengeHandler is null
or if it does not return any credential, the Authorization
error is returned to the caller as if the request was executed out of the AuthenticationManager.
Most generally the ChallengeHandler displays the UI allowing the user to enter the username/password for accessing the resource. Unlike for WinStore application, the API does not provide any default UI for Desktop. However, a default challenge handler is set for managing the access though OAuth when the OAuthAuthorizeHandler is set.
Properties
Name | Description |
---|---|
ChallengeHandler | Gets or sets the component that handles the authorization errors in order to get a valid credential object. |
Credentials | Gets the credentials registered by the Authentication Manager. |
Current | Gets the single AuthenticationManager instance. This is the only way to get an instance of AuthenticationManager. |
OAuthAuthorizeHandler | Gets or sets the component sets the component that handles authorization by a resource owner in an oauth workflow. |
OAuthUserConfigurations | Gets an editable list of OAuthUserConfiguration object, which contain necessary information for creating OAuth user credentials. |
Persistence | Gets or sets the credential persistence. |
ServerInfos | Gets the registered servers. |
TokenExpirationInterval | Gets or sets the default suggested expiration interval (lifetime) of all tokens. |
Methods
Name | Description |
---|---|
AddCredential(Credential) | Adds a new Credential that the AuthenticationManager will use for accessing the resources. |
AddCredentials(IEnumerable<Credential>) | Adds a set of new Credentials that the AuthenticationManager will use for accessing resources. |
FindCredential(Uri, AuthenticationType) | Returns the credential that supports the specified authentication type for the resource identified by the specified url. |
FindServerInfo(Uri) | Returns information about the server that is hosting at the specified url. |
GenerateCredentialAsync(Uri, GenerateTokenOptions) | Generates a token credential object asynchronously. You need to provide the service URL. This is a helper method typically called by the UI challenging the user. |
GenerateCredentialAsync(Uri, String, String, GenerateTokenOptions) | Generates a token credential object asynchronously. You need to provide the service URI, the username and the password. This is a helper method typically called by the UI challenging the user. |
GetCredentialAsync(CredentialRequestInfo, Boolean) | Returns a Credential object of the specified type (credentialRequestInfo.AuthenticationType) that can be used to access the secured resource identified by the input url (credentialRequestInfo.Url). If required, the challenge method will be called and should return the expected credential object. If case of Token AuthenticationType, the user is typically challenged for a username and password which are used to generate a token. This method is typically called internally when a request fails due to an "invalid credentials" error. |
RegisterServer(ServerInfo) | Configures a secured server and its token endpoints manually. In most cases, this is unnecessary as the Authentication Manager can automatically discover the location of the secure server and its token endpoints. |
RemoveAllCredentials() | Removes all stored credentials so the challenge handler will be called the next time access to a secured resource is needed. |
RemoveAndRevokeAllCredentialsAsync() | Removes all credentials from the cache and revokes tokens if appropriate. |
RemoveAndRevokeCredentialAsync(Credential) | Removes the given credential from the cache and revokes its token if appropriate. |
RemoveCredential(Credential) | Removes an existing credential so the challenge handler will be called the next time an access to the resources is needed. |
Applies to
Target | Versions |
---|---|
.NET Standard 2.0 | 100.3 - 200.5 |
.NET | 100.13 - 200.5 |
.NET Windows | 100.13 - 200.5 |
.NET Android | 200.0 - 200.5 |
.NET iOS | 200.0 - 200.5 |
.NET Framework | 100.0 - 200.5 |
Xamarin.Android | 100.0 - 100.15 |
Xamarin.iOS | 100.0 - 100.15 |
UWP | 100.0 - 200.5 |