Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Playing with NT authentication and AD
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Playing with NT authentication and AD

 Post Reply Post Reply Page  <12
Author
Jono View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 18 September 2006
Location: United Kingdom
Status: Offline
Points: 100
Post Options Post Options   Thanks (0) Thanks(0)   Quote Jono Quote  Post ReplyReply Direct Link To This Post Posted: 19 September 2006 at 5:10pm

Lonissa in the first post had a requirement for not displaying the Student’s number (which was their logon ID [SAMaccountName]). The following code modified from version 8.04 should utilise the “FullName” attribute from the WinNT provider. It works on my test network, which isn’t particularly hardened. Watch out for line wrap!

 

I’ve also got some idea’s on utilising Active Directory to populate other information such as email address and then running a script to ensure that information in the two databases are synchronised (i.e. people deleted from AD can be disabled/removed from the Forum and will sync name changes/email addresses, etc.) – this would require an account on AD as IIS6 (Win2003) is more secure than 5.1 (win2000).

 

 

Issue: When Active Directory integration is enabled, the user’s SAMaccountName is displayed– this makes it difficult to identify the user.

 

Solution: This can be changed by modifying the code in “functions_windows_authentication.asp” starting at line 137 from:

 

'Use the last part of the windows authentication (bit without domain) as the forum username

If InStrRev(strAuthenticatedUser, "\") = 0 Then

          strUserName = strAuthenticatedUser

Else

          strUserName = Mid(strAuthenticatedUser, InStrRev(strAuthenticatedUser, "\")+1, Len(strAuthenticatedUser))

End If

 

To:

 

'* This change utilises the WINNT provider to obtain the user's "FullName" rather than SAMaccountName

'* NOTE: Variable declarations are within the modified to contain all changes

 

'Set error trapping

On Error Resume Next

 

'Declare the object to hold user information

Dim objUser

 

'Bind to the object - we need to swap \ with / for binding

Set objUser = GetObject("WinNT://" & replace(strAuthenticatedUser,"\","/"))

 

'If an error has occured while binding, use SAMaccountName

If Err.Number <> 0 Then

          'Use the last part of the windows authentication (bit without domain) as the forum username

          If InStrRev(strAuthenticatedUser, "\") = 0 Then

                   strUserName = strAuthenticatedUser

          Else

                   strUserName = Mid(strAuthenticatedUser, InStrRev(strAuthenticatedUser, "\")+1, Len(strAuthenticatedUser))

Back to Top
synistyr View Drop Down
Newbie
Newbie


Joined: 27 October 2006
Status: Offline
Points: 4
Post Options Post Options   Thanks (0) Thanks(0)   Quote synistyr Quote  Post ReplyReply Direct Link To This Post Posted: 27 October 2006 at 6:08pm
Just tried out that change, and it seems to be working great!
 
Many thanks!
 
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.