HighTechTalks DotNet Forums  

role/group authorization not recognizing user groups.

ASP.net Security microsoft.public.dotnet.framework.aspnet.security


Discuss role/group authorization not recognizing user groups. in the ASP.net Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
TygerKrash
 
Posts: n/a

Default role/group authorization not recognizing user groups. - 11-06-2007 , 06:35 AM






I've seen other posts that seem to have a similar problem but none
with a posted solution, so here goes again..

My application does not allow anonymous access, and integrated windows
authentication is enabled.

In my web config I have the following:

<authentication mode="Windows"/>
<authorization>
<allow roles="ie.mydomain\EDI_GROUP,ie.mydomain\EDI_OPS"/>
<deny users="*"/>
</authorization>
<identity impersonate="true"/>

As far as I can tell this should be all I need.


However users who are members of the domain groups EDI_GROUP or
EDI_OPS get access denied for the default.aspx page (in application
root directory).


I have verified the users are members of the groups and that host is
aware of the groups ( double checked by restarting the server..
twice!).

Interesting, within the application I can programatically identify the
users as members of the groups but only if I use:

WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

If I try to use :

IPrincipal principal = Thread.CurrentPrincipal;
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

memberOfEDI_Ops will be false ( further investigation revealed that
the IPrincipal here was in fact a GenericPrincipal and not the
required WindowsPrincipal).


This may be a red herring but the second approach will in fact return
a WindowsPrincipal when running on the devstudio web server on my
development machine.


My development machine is an XP SP2 machine and the IIS server is a
2003 machine with SP1.

Any Ideas, suggestions?


Reply With Quote
  #2  
Old   
Joe Kaplan
 
Posts: n/a

Default Re: role/group authorization not recognizing user groups. - 11-10-2007 , 08:58 AM






It is strange that your Thread.CurrentPrincipal isn't a WindowsPrincipal.
What is the Context.User property in this case? Thread.CurrentPrincipal and
Context.User should be the same in an ASP.NET app in most circumstances.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"TygerKrash" <dave.mcgowan (AT) gmail (DOT) com> wrote

Quote:
I've seen other posts that seem to have a similar problem but none
with a posted solution, so here goes again..

My application does not allow anonymous access, and integrated windows
authentication is enabled.

In my web config I have the following:

authentication mode="Windows"/
authorization
allow roles="ie.mydomain\EDI_GROUP,ie.mydomain\EDI_OPS"/
deny users="*"/
/authorization
identity impersonate="true"/

As far as I can tell this should be all I need.


However users who are members of the domain groups EDI_GROUP or
EDI_OPS get access denied for the default.aspx page (in application
root directory).


I have verified the users are members of the groups and that host is
aware of the groups ( double checked by restarting the server..
twice!).

Interesting, within the application I can programatically identify the
users as members of the groups but only if I use:

WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

If I try to use :

IPrincipal principal = Thread.CurrentPrincipal;
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

memberOfEDI_Ops will be false ( further investigation revealed that
the IPrincipal here was in fact a GenericPrincipal and not the
required WindowsPrincipal).


This may be a red herring but the second approach will in fact return
a WindowsPrincipal when running on the devstudio web server on my
development machine.


My development machine is an XP SP2 machine and the IIS server is a
2003 machine with SP1.

Any Ideas, suggestions?




Reply With Quote
  #3  
Old   
TygerKrash
 
Posts: n/a

Default Re: role/group authorization not recognizing user groups. - 11-12-2007 , 11:28 AM



Hi Joe,
Thanks for the reply.

I've just checked and Context.User is also appearing as a
GenericPrincipal (representing the same user).

I can ,and given time constraints I probably will, just identify the
users role programatically and enforce my authorization that way,
so this isn't that serious a problem, but I am curious to get to the
bottom of this.


Dave.

On Nov 10, 2:58 pm, "Joe Kaplan"
<joseph.e.kap... (AT) removethis (DOT) accenture.com> wrote:
Quote:
It is strange that your Thread.CurrentPrincipal isn't a WindowsPrincipal.
What is the Context.User property in this case? Thread.CurrentPrincipal and
Context.User should be the same in an ASP.NET app in most circumstances.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"http://www.directoryprogramming.net
--"TygerKrash" <dave.mcgo... (AT) gmail (DOT) com> wrote in message

news:1194352514.662852.295560 (AT) 57g2000hsv (DOT) googlegroups.com...

I've seen other posts that seem to have a similar problem but none
with a posted solution, so here goes again..

My application does not allow anonymous access, and integrated windows
authentication is enabled.

In my web config I have the following:

authentication mode="Windows"/
authorization
allow roles="ie.mydomain\EDI_GROUP,ie.mydomain\EDI_OPS"/
deny users="*"/
/authorization
identity impersonate="true"/

As far as I can tell this should be all I need.

However users who are members of the domain groups EDI_GROUP or
EDI_OPS get access denied for the default.aspx page (in application
root directory).

I have verified the users are members of the groups and that host is
aware of the groups ( double checked by restarting the server..
twice!).

Interesting, within the application I can programatically identify the
users as members of the groups but only if I use:

WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

If I try to use :

IPrincipal principal = Thread.CurrentPrincipal;
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

memberOfEDI_Ops will be false ( further investigation revealed that
the IPrincipal here was in fact a GenericPrincipal and not the
required WindowsPrincipal).

This may be a red herring but the second approach will in fact return
a WindowsPrincipal when running on the devstudio web server on my
development machine.

My development machine is an XP SP2 machine and the IIS server is a
2003 machine with SP1.

Any Ideas, suggestions?



Reply With Quote
  #4  
Old   
Joe Kaplan
 
Posts: n/a

Default Re: role/group authorization not recognizing user groups. - 11-12-2007 , 11:35 AM



If your app is using Windows security in IIS and web.config, the
authenticated user (Context.User) should be a WindowsPrincipal. Is it
possible something else has been added to the stack like membership or
something? I honestly don't know.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"
http://www.directoryprogramming.net
--
"TygerKrash" <dave.mcgowan (AT) gmail (DOT) com> wrote

Quote:
Hi Joe,
Thanks for the reply.

I've just checked and Context.User is also appearing as a
GenericPrincipal (representing the same user).

I can ,and given time constraints I probably will, just identify the
users role programatically and enforce my authorization that way,
so this isn't that serious a problem, but I am curious to get to the
bottom of this.


Dave.

On Nov 10, 2:58 pm, "Joe Kaplan"
joseph.e.kap... (AT) removethis (DOT) accenture.com> wrote:
It is strange that your Thread.CurrentPrincipal isn't a WindowsPrincipal.
What is the Context.User property in this case? Thread.CurrentPrincipal
and
Context.User should be the same in an ASP.NET app in most circumstances.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"http://www.directoryprogramming.net
--"TygerKrash" <dave.mcgo... (AT) gmail (DOT) com> wrote in message

news:1194352514.662852.295560 (AT) 57g2000hsv (DOT) googlegroups.com...

I've seen other posts that seem to have a similar problem but none
with a posted solution, so here goes again..

My application does not allow anonymous access, and integrated windows
authentication is enabled.

In my web config I have the following:

authentication mode="Windows"/
authorization
allow roles="ie.mydomain\EDI_GROUP,ie.mydomain\EDI_OPS"/
deny users="*"/
/authorization
identity impersonate="true"/

As far as I can tell this should be all I need.

However users who are members of the domain groups EDI_GROUP or
EDI_OPS get access denied for the default.aspx page (in application
root directory).

I have verified the users are members of the groups and that host is
aware of the groups ( double checked by restarting the server..
twice!).

Interesting, within the application I can programatically identify the
users as members of the groups but only if I use:

WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

If I try to use :

IPrincipal principal = Thread.CurrentPrincipal;
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

memberOfEDI_Ops will be false ( further investigation revealed that
the IPrincipal here was in fact a GenericPrincipal and not the
required WindowsPrincipal).

This may be a red herring but the second approach will in fact return
a WindowsPrincipal when running on the devstudio web server on my
development machine.

My development machine is an XP SP2 machine and the IIS server is a
2003 machine with SP1.

Any Ideas, suggestions?





Reply With Quote
  #5  
Old   
TygerKrash
 
Posts: n/a

Default Re: role/group authorization not recognizing user groups. - 11-14-2007 , 09:38 AM



Theres no Membership entry in our application web config, maybe it's
something set in the machine.config but looking at that makes me kind
of dizzy! Guess I'll mark this one up as 'weird' for the time being.
I'll work around it and move on.

thanks for your help.

On Nov 12, 5:35 pm, "Joe Kaplan"
<joseph.e.kap... (AT) removethis (DOT) accenture.com> wrote:
Quote:
If your app is using Windows security in IIS and web.config, the
authenticated user (Context.User) should be a WindowsPrincipal. Is it
possible something else has been added to the stack like membership or
something? I honestly don't know.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services Programming"http://www.directoryprogramming.net
--"TygerKrash" <dave.mcgo... (AT) gmail (DOT) com> wrote in message

news:1194888499.408333.159770 (AT) v2g2000hsf (DOT) googlegroups.com...

Hi Joe,
Thanks for the reply.

I've just checked and Context.User is also appearing as a
GenericPrincipal (representing the same user).

I can ,and given time constraints I probably will, just identify the
users role programatically and enforce my authorization that way,
so this isn't that serious a problem, but I am curious to get to the
bottom of this.

Dave.

On Nov 10, 2:58 pm, "Joe Kaplan"
joseph.e.kap... (AT) removethis (DOT) accenture.com> wrote:
It is strange that your Thread.CurrentPrincipal isn't a WindowsPrincipal.
What is the Context.User property in this case? Thread.CurrentPrincipal
and
Context.User should be the same in an ASP.NET app in most circumstances.

Joe K.

--
Joe Kaplan-MS MVP Directory Services Programming
Co-author of "The .NET Developer's Guide to Directory Services
Programming"http://www.directoryprogramming.net
--"TygerKrash" <dave.mcgo... (AT) gmail (DOT) com> wrote in message

news:1194352514.662852.295560 (AT) 57g2000hsv (DOT) googlegroups.com...

I've seen other posts that seem to have a similar problem but none
with a posted solution, so here goes again..

My application does not allow anonymous access, and integrated windows
authentication is enabled.

In my web config I have the following:

authentication mode="Windows"/
authorization
allow roles="ie.mydomain\EDI_GROUP,ie.mydomain\EDI_OPS"/
deny users="*"/
/authorization
identity impersonate="true"/

As far as I can tell this should be all I need.

However users who are members of the domain groups EDI_GROUP or
EDI_OPS get access denied for the default.aspx page (in application
root directory).

I have verified the users are members of the groups and that host is
aware of the groups ( double checked by restarting the server..
twice!).

Interesting, within the application I can programatically identify the
users as members of the groups but only if I use:

WindowsPrincipal principal = new
WindowsPrincipal(WindowsIdentity.GetCurrent());
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

If I try to use :

IPrincipal principal = Thread.CurrentPrincipal;
bool memberOfEDI_Ops = principal.IsInRole("EDI_Ops");

memberOfEDI_Ops will be false ( further investigation revealed that
the IPrincipal here was in fact a GenericPrincipal and not the
required WindowsPrincipal).

This may be a red herring but the second approach will in fact return
a WindowsPrincipal when running on the devstudio web server on my
development machine.

My development machine is an XP SP2 machine and the IIS server is a
2003 machine with SP1.

Any Ideas, suggestions?



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.