// Borland C++ Builder
// Copyright (c) 1995, 2005 by Borland Software Corporation
// All rights reserved

// (DO NOT EDIT: machine generated header) 'Inuseraccounts.pas' rev: 10.00

#ifndef InuseraccountsHPP
#define InuseraccountsHPP

#pragma delphiheader begin
#pragma option push
#pragma option -w-      // All warnings off
#pragma option -Vx      // Zero-length empty class member functions
#pragma pack(push,8)
#include <System.hpp>	// Pascal unit
#include <Sysinit.hpp>	// Pascal unit
#include <Classes.hpp>	// Pascal unit
#include <Inexception.hpp>	// Pascal unit
#include <Inglobal.hpp>	// Pascal unit
#include <Inbasecomponent.hpp>	// Pascal unit
#include <Incomponent.hpp>	// Pascal unit
#include <Instrings.hpp>	// Pascal unit
#include <Sysutils.hpp>	// Pascal unit

//-- user supplied -----------------------------------------------------------

namespace Inuseraccounts
{
//-- type declarations -------------------------------------------------------
typedef unsigned TIdUserHandle;

typedef int TIdUserAccess;

#pragma option push -b-
enum TIdCustomUserManagerOption { umoCaseSensitiveUsername, umoCaseSensitivePassword };
#pragma option pop

typedef Set<TIdCustomUserManagerOption, umoCaseSensitiveUsername, umoCaseSensitivePassword>  TIdCustomUserManagerOptions;

typedef void __fastcall (__closure *TIdUserManagerAuthenticationEvent)(System::TObject* Sender, const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess);

typedef void __fastcall (__closure *TIdUserManagerLogoffEvent)(System::TObject* Sender, unsigned &VUserHandle);

class DELPHICLASS TIdCustomUserManager;
class PASCALIMPLEMENTATION TIdCustomUserManager : public Inbasecomponent::TInBaseComponent 
{
	typedef Inbasecomponent::TInBaseComponent inherited;
	
protected:
	AnsiString FDomain;
	TIdUserManagerAuthenticationEvent FOnAfterAuthentication;
	TIdUserManagerAuthenticationEvent FOnBeforeAuthentication;
	TIdUserManagerLogoffEvent FOnLogoffUser;
	virtual void __fastcall DoBeforeAuthentication(const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess);
	virtual void __fastcall DoAuthentication(const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess) = 0 ;
	virtual void __fastcall DoAfterAuthentication(const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess);
	virtual void __fastcall DoLogoffUser(unsigned &VUserHandle);
	virtual TIdCustomUserManagerOptions __fastcall GetOptions(void);
	virtual void __fastcall SetDomain(const AnsiString AValue);
	virtual void __fastcall SetOptions(const TIdCustomUserManagerOptions AValue);
	__property AnsiString Domain = {read=FDomain, write=SetDomain};
	__property TIdCustomUserManagerOptions Options = {read=GetOptions, write=SetOptions, nodefault};
	__property TIdUserManagerAuthenticationEvent OnBeforeAuthentication = {read=FOnBeforeAuthentication, write=FOnBeforeAuthentication};
	__property TIdUserManagerAuthenticationEvent OnAfterAuthentication = {read=FOnAfterAuthentication, write=FOnAfterAuthentication};
	__property TIdUserManagerLogoffEvent OnLogoffUser = {read=FOnLogoffUser, write=FOnLogoffUser};
	
public:
	virtual AnsiString __fastcall ChallangeUser(bool &VIsSafe, const AnsiString AUserName);
	bool __fastcall AuthenticateUser(const AnsiString AUsername, const AnsiString APassword)/* overload */;
	int __fastcall AuthenticateUser(const AnsiString AUsername, const AnsiString APassword, unsigned &VUserHandle)/* overload */;
	/*         class method */ static bool __fastcall IsRegisteredUser(TMetaClass* vmt, int AUserAccess);
	virtual void __fastcall LogoffUser(unsigned AUserHandle);
	virtual void __fastcall UserDisconnected(const AnsiString AUser);
public:
	#pragma option push -w-inl
	/* TInBaseComponent.Create */ inline __fastcall TIdCustomUserManager(Classes::TComponent* AOwner)/* overload */ : Inbasecomponent::TInBaseComponent(AOwner) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TComponent.Destroy */ inline __fastcall virtual ~TIdCustomUserManager(void) { }
	#pragma option pop
	
};


class DELPHICLASS TIdSimpleUserManager;
class PASCALIMPLEMENTATION TIdSimpleUserManager : public TIdCustomUserManager 
{
	typedef TIdCustomUserManager inherited;
	
protected:
	TIdCustomUserManagerOptions FOptions;
	TIdUserManagerAuthenticationEvent FOnAuthentication;
	virtual void __fastcall DoAuthentication(const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess);
	virtual TIdCustomUserManagerOptions __fastcall GetOptions(void);
	virtual void __fastcall SetOptions(const TIdCustomUserManagerOptions AValue);
	
__published:
	__property Domain ;
	__property Options ;
	__property OnBeforeAuthentication ;
	__property TIdUserManagerAuthenticationEvent OnAuthentication = {read=FOnAuthentication, write=FOnAuthentication};
	__property OnAfterAuthentication ;
	__property OnLogoffUser ;
public:
	#pragma option push -w-inl
	/* TInBaseComponent.Create */ inline __fastcall TIdSimpleUserManager(Classes::TComponent* AOwner)/* overload */ : TIdCustomUserManager(AOwner) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TComponent.Destroy */ inline __fastcall virtual ~TIdSimpleUserManager(void) { }
	#pragma option pop
	
};


class DELPHICLASS TIdUserAccount;
class PASCALIMPLEMENTATION TIdUserAccount : public Classes::TCollectionItem 
{
	typedef Classes::TCollectionItem inherited;
	
protected:
	Classes::TStrings* FAttributes;
	System::TObject* FData;
	AnsiString FUserName;
	AnsiString FPassword;
	AnsiString FRealName;
	int FAccess;
	void __fastcall SetAttributes(const Classes::TStrings* AValue);
	virtual void __fastcall SetPassword(const AnsiString AValue);
	
public:
	__fastcall virtual TIdUserAccount(Classes::TCollection* ACollection);
	__fastcall virtual ~TIdUserAccount(void);
	virtual bool __fastcall CheckPassword(const AnsiString APassword);
	__property System::TObject* Data = {read=FData, write=FData};
	
__published:
	__property int Access = {read=FAccess, write=FAccess, default=0};
	__property Classes::TStrings* Attributes = {read=FAttributes, write=SetAttributes};
	__property AnsiString UserName = {read=FUserName, write=FUserName};
	__property AnsiString Password = {read=FPassword, write=SetPassword};
	__property AnsiString RealName = {read=FRealName, write=FRealName};
};


class DELPHICLASS TInUserAccounts;
class DELPHICLASS TIdUserManager;
class PASCALIMPLEMENTATION TInUserAccounts : public Classes::TOwnedCollection 
{
	typedef Classes::TOwnedCollection inherited;
	
public:
	TIdUserAccount* operator[](AnsiString AUserName) { return UserNames[AUserName]; }
	
protected:
	bool FCaseSensitiveUsernames;
	bool FCaseSensitivePasswords;
	TIdUserAccount* __fastcall GetAccount(const int AIndex);
	TIdUserAccount* __fastcall GetByUsername(const AnsiString AUsername);
	void __fastcall SetAccount(const int AIndex, TIdUserAccount* AAccountValue);
	
public:
	HIDESBASE TIdUserAccount* __fastcall Add(void);
	__fastcall TInUserAccounts(TIdUserManager* AOwner);
	__property bool CaseSensitiveUsernames = {read=FCaseSensitiveUsernames, write=FCaseSensitiveUsernames, nodefault};
	__property bool CaseSensitivePasswords = {read=FCaseSensitivePasswords, write=FCaseSensitivePasswords, nodefault};
	__property TIdUserAccount* UserNames[AnsiString AUserName] = {read=GetByUsername/*, default*/};
	__property TIdUserAccount* Items[int AIndex] = {read=GetAccount, write=SetAccount};
public:
	#pragma option push -w-inl
	/* TCollection.Destroy */ inline __fastcall virtual ~TInUserAccounts(void) { }
	#pragma option pop
	
};


class PASCALIMPLEMENTATION TIdUserManager : public TIdCustomUserManager 
{
	typedef TIdCustomUserManager inherited;
	
protected:
	TInUserAccounts* FAccounts;
	virtual void __fastcall DoAuthentication(const AnsiString AUsername, AnsiString &VPassword, unsigned &VUserHandle, int &VUserAccess);
	virtual TIdCustomUserManagerOptions __fastcall GetOptions(void);
	void __fastcall SetAccounts(TInUserAccounts* AValue);
	virtual void __fastcall SetOptions(const TIdCustomUserManagerOptions AValue);
	virtual void __fastcall InitComponent(void);
	
public:
	__fastcall virtual ~TIdUserManager(void);
	
__published:
	__property TInUserAccounts* Accounts = {read=FAccounts, write=SetAccounts};
	__property Options ;
	__property OnBeforeAuthentication ;
	__property OnAfterAuthentication ;
public:
	#pragma option push -w-inl
	/* TInBaseComponent.Create */ inline __fastcall TIdUserManager(Classes::TComponent* AOwner)/* overload */ : TIdCustomUserManager(AOwner) { }
	#pragma option pop
	
};


//-- var, const, procedure ---------------------------------------------------
extern PACKAGE unsigned IdUserHandleNone;
extern PACKAGE unsigned IdUserHandleBroadcast;
extern PACKAGE int IdUserAccessDenied;
static const Shortint IdUserAccountDefaultAccess = 0x0;

}	/* namespace Inuseraccounts */
using namespace Inuseraccounts;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Inuseraccounts
