[home]  [scripts]  [news]  [forums]  [feedback] 
Home
...a journey into a lost mind. Don't suppose you found it?
NT Authentication  (id:1109 ) (7916 hits)
Description:
This function will return whether or not the credentials passed by a user are correct or not. To use this function, you need to pass the provider you use (only WinNT or LDAP at the moment), the domain the users account is on and the username and password they entered.

The function will then attempt to open that users account object from the credentials supplied. If the account doesn't exist or the password is wrong then an error occurs.

We catch the error and determine that the authentica 
Code:
Const ADS_SECURE_AUTHENTICATION = 1

Function IsAuthenticated(Provider, Domain, Username, Password)
    On Error Resume Next
    Dim authNamespace, authObject
    Set authNamespace = GetObject(Provider & ":")
        
    Select Case Provider
        Case "WinNT"
            Set authObject = authNamespace.OpenDSObject(Provider & "://" & Domain, Domain & "\" & strUsername, strPassword, ADS_SECURE_AUTHENTICATION)
        Case "LDAP"
            Set authObject = authNamespace.OpenDSObject(Provider & "://dc=" & Domain & ",dc=yoursite,dc=com", "cn=" & Username & ",cn=Users,dc=" & Domain & ",dc=yoursite,dc=com", strPassword, ADS_SECURE_AUTHENTICATION)
    End Select
        
    If Err.Number <> 0 Then
        IsAuthenticated = False
    Else
        IsAuthenticated = True
    End If
    Set authNamespace = Nothing
    Set authObject = Nothing
End Function 
Created:
11/12/2002 7:04:00 PM 
Created By:
mparter 
Download URL:
 
Category:
ASP/VBScript 
Sample URL:
 
Updated:
11/26/2002 7:10:00 PM 
RSS Subscriptions
Advanced Script Search

Keyword(s)


Category