REST.Client.TRESTClient.Authenticator
Delphi
property Authenticator: TCustomAuthenticator read GetAuthenticator write SetAuthenticator;
C++
__property Authenticator;
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
property | published | REST.Client.pas REST.Client.hpp |
REST.Client | TRESTClient |
Description
Instance d'une sous-classe de TCustomAuthenticator devant être utilisée pour l'authentification sur le serveur.
REST.Client.TRESTClient.Authenticator hérite de REST.Client.TCustomRESTClient.Authenticator. Tout le contenu en-dessous de cette ligne se réfère à REST.Client.TCustomRESTClient.Authenticator.
Instance d'une sous-classe de TCustomAuthenticator devant être utilisée pour l'authentification sur le serveur.
Authenticator vaut nil par défaut, ce qui signifie qu'aucune authentification n'est utilisée.
TCustomRESTClient devient le propriétaire de son authentificateur. Vous n'avez donc pas besoin de détruire un authentificateur antérieur lorsque vous assignez une nouvelle valeur à la propriété Authenticator.
Exemple de code
Delphi :
LClient := TCustomRESTClient.Create('http://www.example.com');
LBasicAuth := THTTPBasicAuthenticator.Create('JaneDoe', 'secret');
LClient.Authenticator := LBasicAuth;
C++ :
TCustomRESTClient* LClient = new TCustomRESTClient("http://www.example.com");
THTTPBasicAuthenticator* LBasicAuth = new THTTPBasicAuthenticator("JaneDoe", "secret");
LClient->Authenticator = LBasicAuth;