REST.Client.TCustomRESTClient.Authenticator
Delphi
property Authenticator: TCustomAuthenticator read FAuthenticator write SetAuthenticator;
C++
__property TCustomAuthenticator* Authenticator = {read=FAuthenticator, write=SetAuthenticator};
Propriétés
Type | Visibilité | Source | Unité | Parent |
---|---|---|---|---|
property | public | REST.Client.pas REST.Client.hpp |
REST.Client | TCustomRESTClient |
Description
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;