AuthenticationKit.Validator

This interface must be implemented by the storage system, which is usually a database connection.

Interface Methods

Function LookupSalt (Hash As Xojo.Core.MemoryBlock) As Xojo.Core.MemoryBlock

The implementor should find the salt from the passwords table matching the provided Hash. Return Nil if Hash cannot be found.

Function LookupUser (LoginKey As Text) As AuthenticationKit.User

The implementor should lookup the user details for the given LoginKey and return an AuthenticationKit.User object. Return Nil if LoginKey cannot be found.

Function Save (Users() As AuthenticationKit.User, Tokens() As AuthenticationKit.Token) As Boolean

The implementor should save all the provided Users and Tokens. Return True if everything saved correctly.

Extension Methods

These methods are supplied by the AuthenticationKit module automatically to all implementors of the interface.

Function AddBogusTokens (Extends Validator As AuthenticationKit.Validator, NumRecords As UInteger, ByteCount As UInteger) As Boolean

Add NumRecords bogus records consisting of ByteCount bytes. This is useful for seeding a validator with excess records which match no user.

Function Save (Extends Validator As AuthenticationKit.Validator, Tokens() As AuthenticationKit.Token) As Boolean

An alias of the Save method which accepts only an array of Tokens.

Function Save (Extends Validator As AuthenticationKit.Validator, User As AuthenticationKit.User, Tokens() As AuthenticationKit.Token) As Boolean

An alias of the Save method which accepts a single User and an array of Tokens.

Function ValidatePassword (Extends Validator As AuthenticationKit.Validator, User As AuthenticationKit.User, Password As Text, ByRef Generator As AuthenticationKit.TwoFactorProfile) As Boolean

Test Password against User. Returns True if the password matches. Generator is a ByRef reference to a AuthenticationKit.TwoFactorProfile that will be set to valid instance if the user has two factor authentication enabled, or set to nil if not enabled.

See Also

AuthenticationKit.Token, AuthenticationKit.TwoFactorProfile