Indy 9 | Content | Index | Reference

TIdUserManager
Hierarchy, Properties, Methods, Events, Unit: IdUserAccounts
Implements an account manager for Indy servers.

    TIdUserManager = class(TIdBaseComponent)

Unit
IdUserAccounts
Description
TIdUserManager is a TIdBaseComponent descendant that implements a mechanism for managing user accounts that can be used by an Indy server. TIdUserManager is the type used to represent the TIdFTPServer.UserAccounts property.

TIdUserManager provides properties that indicate characteristics of the user accounts for the server implementation, including:

- Accounts - Collection of user accounts.

- CaseSensitiveUsernames - Indicates case is significant when checking an account identity.

- CaseSensitivePasswords - Indicates case is significant when checking account credentials.

TIdUserManager also provides methods and event handlers that allow authentication of a user account using the identity and credentials provided by a client connection.

TIdUserManager.Accounts
TIdUserManager
Represents the collection used for user accounts managed by the component.

    property Accounts: TIdUserAccounts;

Description
Accounts is a TIdUserAccounts property that represents a collection used for TIdUserAccount object instances maintained by the user manager. Accounts is initialized in Create, and freed in Destroy.

Accounts is used in AuthenicateUser to locate the collection item used for the authorization process. Accounts is also accessed when reading or writing the values in CaseSensitivePasswords and GetCaseSensitiveUsernames.

TIdUserManager.CaseSensitivePasswords
TIdUserManager
Indicates case is significant when verifying passwords for user accounts.

    property CaseSensitivePasswords: Boolean;

Description
CaseSensitivePasswords is a Boolean property that indicates if case is significant when verifying the authentication credentials against the Password stored in a user account. When CaseSensitivePasswords is True, case is significant. When CaseSensitivePasswords is False, case is not significant.

CaseSensitivePasswords uses a read and a write specifier to provide access the TIdUserAccounts.CaseSensitivePasswords property.

Use CaseSensitiveUsernames to indicate if case is significant when accessing user accounts by the identity for the user account.

TIdUserManager.CaseSensitiveUsernames
TIdUserManager
Indicates if case is significant when accessing user accounts by user name.

    property CaseSensitiveUsernames: Boolean;

Description
CaseSensitiveUsernames is a Boolean property that indicates if case is significant when accessing user accounts in the collection using UserNames.

When CaseSensitiveUsernames is True, the read access specifier for the UserNames property will consider case to be significant in comparing the user name values. When CaseSensitiveUsernames is False, AnsiSameText is used to perform the name comparison.

CaseSensitiveUsernames uses a read and a write specifier to provide access the TIdUserAccounts.CaseSensitiveUsernames property.

Use CaseSensitivePasswords to indicate if case is significant when verifying user account credentials maintained by the user manager.

TIdUserManager.AuthenticateUser
TIdUserManager
Authenticates user identity and credentials using user accounts.

    function AuthenticateUser(const AUsername: String; const APassword: String): Boolean;

Parameters
const AUsername: String
User identity to validate.
const APassword: String
User credentials to validate.
Return Value
Boolean - True when authentication was successful.
Description
AuthenticateUser is a Boolean function that authenticates a user account using the values specified in AUsername and APassword. AuthenticateUser retrieves the TIdUserAccount identified by AUsername. If a user account having the specified name cannot be located, AuthenticateUser will return False.

AuthenticateUser calls TIdUSerAccount.CheckPassword for the value specified in APassword to complete the authorization process. After aythentication, the OnAfterAuthentication event handler is signalled to allow verification against an external source or logging for account access attempts.

TIdUserManager.Create
TIdUserManager
Constructor for the object instance.

    constructor Create(AOwner: TComponent); override;

Parameters
AOwner: TComponent
Owner of the object instance.
Description
Create is the constructor for the object instance. Create calls the inherited Create method using the value in AOwner. Create also allocates resources required for the Accounts property.

TIdUserManager.Destroy
TIdUserManager, See Also
Frees the object instance.

    destructor Destroy; override;

Description
Destroy is the destructor for the object instance. Destroy frees and release resources allocated in the Create method, including Accounts. Destroy calls the inherited Destroy method prior to exiting.

TIdUserManager.OnAfterAuthentication
TIdUserManager
Event handler signalled after an attempt to authenticate a user account.

    property OnAfterAuthentication: TOnAfterAuthentication;

Parameters
AAuthenticationResult
Result of the authentication process.
APassword
User credentials for the authentication process.
AUsername
User identity for the authentication process.
Description
OnAfterAuthentication is a TOnAfterAuthentication property that represents the event handler signalled after an attempt to authenticate a user account. Arguments for the event handler include the user identity (AUserName) and credentials (APassword) used for authenticating the client account.

Applications must assign a procedure to the event handler to allow responding to the event notification. The OnAfterAuthentication event handler can be use to perform authentication where the account identity or credentials are stored outside the server implementation, or where additional logging is required after an attempt to access the server.

The OnAfterAuthentication event handler can change the value in AAuthenticationResult to indicate if the authentication attempt was successful.

OnAfterAuthentication is used in the AuthenticateUser method after the user account identified in AUsername has verified the password in APassword for the user account. AAuthenticationResult contains the result for the account authorization prior to signalling the TOnAfterAuthentication event.

Created with Doc-O-Matic 2 donated to Project JEDI. Commercial license available from the Doc-O-Matic site.