Class wwUserSecurity

The wwUserSecurity class provides a base interface for implementing FoxPro table and Windows Auth user authentication. The class includes user retrieval and non-visual management features like adding deleting etc.

Custom wwUserSecurity

Class Members

MemberDescription
Authenticate This method is called to authenticate a user. This method can be overriden to provide custom functionality. If the user logon is successful the user record (`.oUser`) is set to the selected user. If…
o.Authenticate(lcUsername, lcPassword)
AuthenticateNt Authenticates username and password against Windows System accounts.
o.AuthenticateNt(lcUsername,lcPassword)
Close Closes the user file.
o.Close()
CreateTable Creates the User table if it doesn't exist. Called by the Open method. To create a new table: ```foxpro o = CREATEOBJECT("UserSecurity") o.CreateTable() && default table defined in…
o.CreateTable(lcFileName)
DeleteUser Deletes the currently selected user.
o.DeleteUser()
FixupTable Method used to fix up the wwUserSecurity table by stripping trailing spaces from text fields and encoding all passwords if `cPasswordEncryptionKey` is set.
o.FixupTable()
GetPasswordHash Retrieves a password hash from an unenrypted string/password value. This method is used internally to encrypt passwords during Save operations. By default this method looks for a ~~ postfix and if…
o.GetPasswordHash(lcPassword,llForce)
GetUser Retrieves a user into the oUser member based on a PK or Username and Password lookup. GetUser always sets the oUser member even on failure in which case the value is set to an empty object.
o.GetUser(lcPK, lcPassword)
GetUserByUsername Like the [GetUser()](vfps://Topic/_1P30TA7ND) method but retrieves a user by username rather than by PK.
o.GetUserByUsername(lcUsername)
GetUserByValidationKey Retrieves a user by the `Validate` field value. Use this when validating a user account or for password recovery.
o.GetUserByValidationKey(lcValidate)
IsEmpty Determines whether a user has been loaded into the `.oUser` instance. Checks whether the `pk` or `username` fields are blank.
o.IsEmpty()
NewUser Creates a new user record and stores it in the `.oUser` member data and returns the `.oUser` as a result. Does not save the new user - call `SaveUser()` after you've updated the `.oUser` properties.
o.NewUser()
Open Opens the user file and/or selects it into cAlias. If the table is already open this method only selects the Alias.
o.Open(lcFileName, llReOpen, llSilent)
Reindex
o.Reindex()
SaveUser Saves the currently active user to file. Saves the oUser member to the database.
o.SaveUser()
cPasswordEncryptionKey Encryption key string that's used to hash the password stored in the `usersecurity` file's `password` field. The value is hashed when a user is saved via the `SaveUser()`. Hashed passwords end in a…
calias Alias of the user file.
cdomain Domain name when using NT Authentication for request.
cerrormsg Holds error messages when lError = .T. or when any methods return False.
cfilename Filename for the user file.
lcasesensitive Determines wheter usernames and passwords are case sensitive. The default is .F.
lerror Error Flag. True when an error occurs during any operation. Set but not required as most methods return True or False.
lRequireValidation If .T. requires accounts to be validated before they can be accessed. Internally this sets the `Active` flag to `.F.`, sets a `Validate` unqiue key value and requires that you validate the account…
ndefaultaccounttimeout The default value when the account should time out in days. Leave this value at 0 to force the account to never timeout.
nminpasswordlength Minimum length of the password.
oUser The actual member that holds user data. Filled by the GetUser and NewUser methods. **Pk** C (10) The unique ID for the user. Shouldn't be manually set usually automatically created by NewUser()…

Assembly: wwUserSecurity.prg



© West Wind Technologies, 2025 • Updated: 2025-03-12
Comment or report problem with topic