472,333 Members | 1,021 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,333 software developers and data experts.

Authentication problem for roles based

Hi,

I'm having what should be a minor problem but has turned into a 2 day slug
fest with ASP.Net. I am simply attempting to authenticate my asp.net
application users against users in an AD group set up on our domain. It
seems to me I am missing something very simple and obvious, but none of the
MSDN articles I have read are indicating what this might be.

My setup is ASP.Net running on a Windows 2003/IIS 6 server. IIS security
settings are set to Integrated Windows Authentication only.

My web.config details are:

<authentication mode="Windows" />
<authorization>
<allow roles="domainname\groupname" />
<deny users="*" />
</authorization>
<identity impersonate="true" />

The problem is that:
1) the application is challenging for a login id/password, and
2) will not authenticate the user even though the credentials supplied
coorespond to an existing user in the specified AD group;

BTW: providing an allow users="domainname\username" works just fine.

Thanks in advance for the help.

Nov 18 '05 #1
4 2073
I've been having the same issue in one of our in-house web application as
well: Yes it shows your proper AD credentials on the application but when
the server passes these credentials to the AD controller, that's where it
gets confused.

From the articles I've found it appears this is a classic double-hop issue
when the iis 6 server tries to pass on your credentials to the ad domain
controller. The only workaround we found was to create a very low-security
AD account that we have encrypted the username and password for, and tossed
these credentials into a text file (in the application's directory) for our
application to use.

If you find another solution please share it as I know there are a few
people who'd like to know.

Note: Even nesting AD impersonation with the following code doesn't seem to
alleviate the double-credential hop/passing.

'Impersonate the windows user running the application
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
Try
'Gather User's username, authentication type and if the user
'is actually authenticated.
Dim p As IPrincipal
Dim i As System.Security.Principal.IIdentity
Dim isAuthenticated As Boolean
Dim authenticationType As String
p = System.Threading.Thread.CurrentPrincipal
i = p.Identity
isAuthenticated = CType(p.Identity.IsAuthenticated, String)
authenticationType = p.Identity.AuthenticationType
ADUserName = p.Identity.Name.Split("\"c)(1)
'Put code here under the current logged-in user
'...
'...
Catch ex As Exception
Response.Write(ex.Message)
End Try

'End impersonation
impersonationContext.Undo()

"Chris Gatto" <cg****@nbnet.nb.ca@removeme> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm having what should be a minor problem but has turned into a 2 day slug
fest with ASP.Net. I am simply attempting to authenticate my asp.net
application users against users in an AD group set up on our domain. It
seems to me I am missing something very simple and obvious, but none of the MSDN articles I have read are indicating what this might be.

My setup is ASP.Net running on a Windows 2003/IIS 6 server. IIS security
settings are set to Integrated Windows Authentication only.

My web.config details are:

<authentication mode="Windows" />
<authorization>
<allow roles="domainname\groupname" />
<deny users="*" />
</authorization>
<identity impersonate="true" />

The problem is that:
1) the application is challenging for a login id/password, and
2) will not authenticate the user even though the credentials supplied
coorespond to an existing user in the specified AD group;

BTW: providing an allow users="domainname\username" works just fine.

Thanks in advance for the help.

Nov 18 '05 #2
TK
If you simply attempt to secure your web application pages in your intRAnet
envirinment, I recommand you to stick up to file level access control rather
than URL level access control. What my understanding from my past
experiences on authentication and authorization mechanism in ASP.NET, is
that the URL level access control feature is a best way for intERnet
clients with Forms Authentication feature. But for intranet clients with
Windows Authentication, URL level access control feature just makes things
complex. You can simply control user and/or group (role) base access rights
by setting NTFS file access permissions.

To use file level access control feature, change your web.config as
following.

<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<identity impersonate="true" />

Then change some settings for your web application in IIS admin tool as
followings.

1. Disable "Anonymous Access".
2. Choose only "Windows integrated authentication".

hth
TK

"Chris Gatto" <cg****@nbnet.nb.ca@removeme> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm having what should be a minor problem but has turned into a 2 day slug
fest with ASP.Net. I am simply attempting to authenticate my asp.net
application users against users in an AD group set up on our domain. It
seems to me I am missing something very simple and obvious, but none of the MSDN articles I have read are indicating what this might be.

My setup is ASP.Net running on a Windows 2003/IIS 6 server. IIS security
settings are set to Integrated Windows Authentication only.

My web.config details are:

<authentication mode="Windows" />
<authorization>
<allow roles="domainname\groupname" />
<deny users="*" />
</authorization>
<identity impersonate="true" />

The problem is that:
1) the application is challenging for a login id/password, and
2) will not authenticate the user even though the credentials supplied
coorespond to an existing user in the specified AD group;

BTW: providing an allow users="domainname\username" works just fine.

Thanks in advance for the help.


Nov 18 '05 #3
Jason,

Thanks for the reply. After reading your post I began carrying out my own
research on the double-hop issue and eventually came across this KB article
(http://support.microsoft.com/default...;en-us;810572). It
appeared that the issue may have been one of simple deligation permissions
on the client and on the IIS/App server. Seems like even though the client
was being authenticated via Windows Authentication (kerberos) on the IIS
server, the IIS server in turn was not permitted to pass on the user's
credentials to the AD controller server for authentication. As a result the
asp.net worker process using its own identity when attempting to get user
credentials from the AD server and was being rejected (thats more our
therory then actual hard fact). According to the KB article the solution is
to enable delegation permissions on both the client and IIS/App server.
This was not an attractive solution simple due to the number of clients that
would have to be enabled for delegation (maintenance and security
headaches).

In the end I realized there was a better solution all along simply by
accessing the user's Context.User.Identity.IsInRole method and verifying
against the desired AD group - the standard forehead-slapping moment :-)
Now I'm working toward a nice security model using a shared class structure
that each aspx page will access up front.

Regards,
Chris

"Jason" <ja***@grossmans.net> wrote in message
news:OG*************@TK2MSFTNGP11.phx.gbl...
I've been having the same issue in one of our in-house web application as
well: Yes it shows your proper AD credentials on the application but when
the server passes these credentials to the AD controller, that's where it
gets confused.

From the articles I've found it appears this is a classic double-hop issue
when the iis 6 server tries to pass on your credentials to the ad domain
controller. The only workaround we found was to create a very low-security AD account that we have encrypted the username and password for, and tossed these credentials into a text file (in the application's directory) for our application to use.

If you find another solution please share it as I know there are a few
people who'd like to know.

Note: Even nesting AD impersonation with the following code doesn't seem to alleviate the double-credential hop/passing.

'Impersonate the windows user running the application
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
Try
'Gather User's username, authentication type and if the user
'is actually authenticated.
Dim p As IPrincipal
Dim i As System.Security.Principal.IIdentity
Dim isAuthenticated As Boolean
Dim authenticationType As String
p = System.Threading.Thread.CurrentPrincipal
i = p.Identity
isAuthenticated = CType(p.Identity.IsAuthenticated, String)
authenticationType = p.Identity.AuthenticationType
ADUserName = p.Identity.Name.Split("\"c)(1)
'Put code here under the current logged-in user
'...
'...
Catch ex As Exception
Response.Write(ex.Message)
End Try

'End impersonation
impersonationContext.Undo()

"Chris Gatto" <cg****@nbnet.nb.ca@removeme> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm having what should be a minor problem but has turned into a 2 day slug fest with ASP.Net. I am simply attempting to authenticate my asp.net
application users against users in an AD group set up on our domain. It
seems to me I am missing something very simple and obvious, but none of

the
MSDN articles I have read are indicating what this might be.

My setup is ASP.Net running on a Windows 2003/IIS 6 server. IIS security settings are set to Integrated Windows Authentication only.

My web.config details are:

<authentication mode="Windows" />
<authorization>
<allow roles="domainname\groupname" />
<deny users="*" />
</authorization>
<identity impersonate="true" />

The problem is that:
1) the application is challenging for a login id/password, and
2) will not authenticate the user even though the credentials supplied
coorespond to an existing user in the specified AD group;

BTW: providing an allow users="domainname\username" works just fine.

Thanks in advance for the help.


Nov 18 '05 #4
Sure Chris,

But I have to add that code to my page/pages...the bugger I have had is that
THIS USED TO WORK! I just had an application break on me so it has to be tied
to some Windows Update or service pack.

I built the app a long time ago and it has been running. I "allow" a
specified user list, but "my" access is controlled through a role/NT Security
group. They called me with a bug/feature to add and when I hit the site...I
was challenged for security. After an MS support call we figured out how to
grant me acess again (I forgot about the web.config entries) but we could not
explain the change.

I'm confused that this change has not been more clearly noted - or fixed.

Best Regards all,

Mark B

"Chris Gatto" wrote:
Jason,
....
In the end I realized there was a better solution all along simply by
accessing the user's Context.User.Identity.IsInRole method and verifying
against the desired AD group - the standard forehead-slapping moment :-)
Now I'm working toward a nice security model using a shared class structure
that each aspx page will access up front.

Regards,
Chris

"Jason" <ja***@grossmans.net> wrote in message
news:OG*************@TK2MSFTNGP11.phx.gbl...
I've been having the same issue in one of our in-house web application as
well: Yes it shows your proper AD credentials on the application but when
the server passes these credentials to the AD controller, that's where it
gets confused.

From the articles I've found it appears this is a classic double-hop issue
when the iis 6 server tries to pass on your credentials to the ad domain
controller. The only workaround we found was to create a very

low-security
AD account that we have encrypted the username and password for, and

tossed
these credentials into a text file (in the application's directory) for

our
application to use.

If you find another solution please share it as I know there are a few
people who'd like to know.

Note: Even nesting AD impersonation with the following code doesn't seem

to
alleviate the double-credential hop/passing.

'Impersonate the windows user running the application
Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()
Try
'Gather User's username, authentication type and if the user
'is actually authenticated.
Dim p As IPrincipal
Dim i As System.Security.Principal.IIdentity
Dim isAuthenticated As Boolean
Dim authenticationType As String
p = System.Threading.Thread.CurrentPrincipal
i = p.Identity
isAuthenticated = CType(p.Identity.IsAuthenticated, String)
authenticationType = p.Identity.AuthenticationType
ADUserName = p.Identity.Name.Split("\"c)(1)
'Put code here under the current logged-in user
'...
'...
Catch ex As Exception
Response.Write(ex.Message)
End Try

'End impersonation
impersonationContext.Undo()

"Chris Gatto" <cg****@nbnet.nb.ca@removeme> wrote in message
news:u9**************@TK2MSFTNGP12.phx.gbl...
Hi,

I'm having what should be a minor problem but has turned into a 2 day slug fest with ASP.Net. I am simply attempting to authenticate my asp.net
application users against users in an AD group set up on our domain. It
seems to me I am missing something very simple and obvious, but none of

the
MSDN articles I have read are indicating what this might be.

My setup is ASP.Net running on a Windows 2003/IIS 6 server. IIS security settings are set to Integrated Windows Authentication only.

My web.config details are:

<authentication mode="Windows" />
<authorization>
<allow roles="domainname\groupname" />
<deny users="*" />
</authorization>
<identity impersonate="true" />

The problem is that:
1) the application is challenging for a login id/password, and
2) will not authenticate the user even though the credentials supplied
coorespond to an existing user in the specified AD group;

BTW: providing an allow users="domainname\username" works just fine.

Thanks in advance for the help.



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Konrad | last post by:
Hi All users should authenticate to reach some page. How to avoid this for some users. Thanks Konrad
4
by: Marty Underwood | last post by:
Okay the subject line explains a scenario I just had to tackle but I am looking for a better way. The current way: 1) Use forms...
1
by: .net user | last post by:
can some one point me what i'm doing wrong? I have spent half a day figuring out and totally stuck now. Here's what I'm trying to accomplish: I...
2
by: Ed | last post by:
Hi I currently have an asp.NET project. I'm using Access 2003 and forms authentication to authenticate users. Can anyone tell me how to set the...
2
by: Brian Shannon | last post by:
I have an intranet site I created when I first began .NET and it is very basic. Now that I have developed my skills I am looking to revamp the old...
4
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I...
2
by: lucd | last post by:
Hello, I am currently playing with form authentication & role based security on a web application. As seen in the starter kit Time tracker,...
5
by: Archer | last post by:
I was making a role-based authentication but it does't login with correct password. the HttpContext.Current.User recieved in Global.asax is...
1
by: Eric | last post by:
I trying to setup an intranet based on windows NT groups or roles. I have used windows integrated authentication with impersonation first but this...
1
by: Joe | last post by:
What I want to do is make only one page require a login. The application itself works fine. I'm getting the following error: Parser Error...
0
by: concettolabs | last post by:
In today's business world, businesses are increasingly turning to PowerApps to develop custom business applications. PowerApps is a powerful tool...
0
better678
by: better678 | last post by:
Question: Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct? Answer: Java is an object-oriented...
0
by: CD Tom | last post by:
This happens in runtime 2013 and 2016. When a report is run and then closed a toolbar shows up and the only way to get it to go away is to right...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.