Solved

Active Directory Authentication by Machine Name

Posted on 2006-11-15
8
736 Views
Last Modified: 2010-02-25
I have developed an Intranet  Web Application using ASP 3.0

There is a section where I can enter my Active Directory Login name & Password
and get authenticated to certain pages.

Now I want to be atumomatically logged in once I open the Intarnent Home Page, since there should some kind of a script that will get my machine Name, and authenticate me based on that my machine is a member of a domain.

0
Comment
Question by:aqunix
  • 3
  • 2
8 Comments
 
LVL 58

Expert Comment

by:amit_g
Comment Utility
Take out Anoymous access and enable only Integrated Windows Authentication. Then user logged in to your domain would be able to get to you page. You can get their loginid in variable Request.ServerVariables("LOGON_USER"). To enable authentication in IIS follow direction in

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/1aa70bfa-add5-4f61-9c7b-a095c1bd4306.mspx?mfr=true
0
 
LVL 58

Expert Comment

by:amit_g
Comment Utility
0
 

Author Comment

by:aqunix
Comment Utility
I know how to enable the Integrated widows Authentication, and I can retrive my PC name.

What I need is:

I want to search for my PC name to the Active directroy and if Exsits and my PC is a member of AC, then I should be authenticated based on the Stored information about my PC in the AC.



0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 58

Expert Comment

by:amit_g
Comment Utility
PC name or User Name? If UserName, after enabling Integrated widows Authentication and taking off Anonymous Authentication, you are gauranteed that anyone who gets to your page is already authenticated via AD as windows logon would have already tested it. So your application need not do anything. On the other hand if you are looking for both Windows Anthentication and Anonymous authentication togethere, it won't work becuase if Anoynous is enabled, there is no way to know who is logged in via a web application as the browser doesn't pass that information to the web server and so asp can't do anything.
0
 

Author Comment

by:aqunix
Comment Utility
I could find the solution:

1- I have downloaded a free DNS component [ aspdns ]
2- This tool will return me the logged in machine Name
3- I could retrive the List of Machine from the Active directory , and I stored them in an Array
4- I searched for the Machine Name if there is a Match in the Array
5- if Machine Name was found then I will be logged in , other wise no access.
6- Then get the Machine Information from the AD.

<%
'------------------- Get the Machine Name of the Logged in User ---------------------
Set DNS = Server.CreateObject("ASPDNS.DNSLookup")
A = DNS.GetIPFromName(Request.ServerVariables("REMOTE_ADDR"))
NameA = DNS.GetNameFromIP(A)
Set DNS = Nothing
SplitName = split(NameA,".",-1)
MachineName = SplitName(0)

strUserName              = Ucase(MachineName)

%>


<%
'------------------- Get the Full Machines Name List from the AD ---------------------

on error resume next

Dim strDomain
Dim strADsPath
Dim strUserName
Dim strPassword
Dim iFlags
Dim errorcount

errorcount = 0

strDomain = "Your AD Domain Name"

strADsPath       = strDomain
iFlags             = Request.Form("Flags")


%>

<%
Function getUsers(strDomain)
    Dim oDomain, User, msg

    Set oDomain = GetObject("WinNT://" & strDomain)
    oDomain.Filter = Array("computer")
    For Each User in oDomain
      msg = msg & User.Name & ","
    Next
    getUsers = msg
End Function

'-------------- Build an Array for the AD Machines -------------------------
MachineArray = getUsers(strDomain)
MachineArray = split(MachineArray,",",-1)
x = Ubound(MachineArray)
x=x+1


' ------------------ Search for the logged Machine Name withen the Array ---------------------
i    = 0
Flag = 0

While i<x
 if strUserName = Ucase(MachineArray(i)) then
 Flag =1
 End if
i=i+1
Wend


'---------------- If Not Found [ NO Access ]
if Flag=0 then
url = "noaccess.asp"
response.Redirect(url)
End if

If Flag=1  then

           Session("USER_LOGIN") = strUserName
           Session("isLoggedIn") = True
           Session("ValidUser")  = True
 

Dim User
Set User = GetObject("WinNT://" & strDomain & "/" & strUserName & ",user")
FullName = User.Fullname
End if

Response.write " Welcome :" & FullName

%>
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now