ASP.NET VETtrak API web services
TAuthenticate Class
public class TAuthenticate;

Authenticate Class. 

Models an attempt to Authenticate a user. A user may attempt to authenticate by passing a username and password, or by passing a token previously obtained. 

The user can be an Employer, a Client or a Staff Member. 

A Token is generated when a user calls a Validate function (ValidateClient, ValidateEmployer or ValidateUser) and passes a valid username and password. 

Both Clients and Staff generate Client Tokens (TokenType = CLIE_TOKEN = '02'), while Employers generate Employer Tokens (TokenType = EMPL_TOKEN = '01'). 

If an Authentication attempt is successful, a 'good' TAuthenticate is returned, containing:

  • Token property : a valid token.
  • Status property : STATUS_OK = 1.
  • StatusMessage property : a string (possible empty - 'no news is good news').
  • TokenType property : the Type of Token (Client Token = '02', Employer Token = '01'). (See Note below)
  • Identifier property : the Identifier of the token's owner,.

If an Authentication attempt is unsuccessful, a 'bad' TAuthenticate is returned, containing:

  • Token property : an empty token ( = '') .
  • Status property : something other then STATUS_OK = 1.
  • StatusMessage property : a string containing a description of the problem.
  • TokenType property : an empty string ( = '') .
  • Identifier property : BAD_IDENTIFIER = '-1' .

Note that the ValidateUser function returns (on successful authentication of a Staff User) a TAuthenticate object containing a Client token and TokenType = STAF_TOKEN = '03'. 

Many functions which perform operations with non-public data, require a Token and return an TAuthenticate Object. 

Often the TAuthenticate object returned is a property (usually .Auth) of another object. For example, with the function GetEnrolmentsForClient, (which returns a TAuthEnroList), it is GetEnrolmentsForClient.Auth . 

Often a function will use a TAuthenticate object as a means of communucating other information - perhaps information about errors other than authentication. For example, a valid token may be passed to a function, but other errors may occur in executing the function. In such cases, a 'bad' TAuthenticate is returned - check the StatusMessage for clues as to what went wrong.

Copyright (c) OzSoft Solutions 2016. All rights reserved.