WeOnlyDo! wodWebServer ActiveX - UserAuthenticate Event
    
 

Description

Fires when user wants to authenticate.


Syntax

Private Sub object_UserAuthenticate(User, AuthType, Action)



The UserAuthenticate Event syntax has these parts:

Part Description
object A wodWebServer object.
User A WebUser object. Reference to User who connected to the server.
AuthType A WebAuthenticationTypes enumeration, as described in settings. You can read here type of authentication used by the client.
Action A WebActions enumeration, as described in settings. You should set this value to Allow if you want to accept user's credentials, or Deny if you don't accept them.

Settings

The settings for AuthType are:

Constant Value Description
 AuthNone 0 No authentication supported.
 AuthBasic 1 Server supports Basic base64 authentication.
 AuthNTLM 2 Server supports NTLM challenge-request authentication.
 AuthCertificate 3 Server supports authentication with client certificate.

The settings for Action are:

Constant Value Description
 Deny 0 Deny execution of the action.
 Allow 1 Allow to execute action.

 


Remarks

UserAuthenticate event is fired when user tries to authenticate with the server (no matter if you require it or not). You should check appropriate properties for the user (such as Login, Password, Certificate) and then decide if you will accept user's credentials - by setting Action = Allow, or deny access by setting Action = Deny.

 

Typically you will do something like this to authenticate user (code sample in VB):

 

Private Sub Http1_UserAuthenticate(ByVal User As WODWEBSERVERCOMLib.IWebUser, ByVal AuthType As WODWEBSERVERCOMLib.WebAuthenticationTypes, Action As WODWEBSERVERCOMLib.WebActions)
  Dim c As Certificate

    Select Case AuthType
      Case AuthCertificate
        Set c = User.Certificate
        If c.PublicKeyOpenSSH = "something you have in database" Then
          Action = Allow
        Else
          Action = Deny
        End If

      Case AuthBasic
        If User.Login = "something" And User.Password = "something" Then
          Action = Allow
        Else
          Action = Deny
        End If

      Case AuthNTLM
        If User.Login = "something" And User.TestNTLMResponse("something") Then
          Action = Allow
        Else
          Action = Deny
        End If
    End Select
End Sub