HighTechTalks DotNet Forums  

GenericPrincipal

Dotnet Security microsoft.public.dotnet.security


Discuss GenericPrincipal in the Dotnet Security forum.



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

Default GenericPrincipal - 09-09-2007 , 01:42 AM






I'm trying to create a use a genericprincipal object with roles
authorization to use in my asp.net apps

My user directs new users to an asp.net login page.
They log in and I use that ifnormation to create a genericidentity.
Then i get their roles from the data store and use that and the
generic identity to create a genericprincipal object.

I then assign the genericprincipal object to the
My.User.CurrentPrincipal.
It all works fine up to this piont

The problem occurs when I navigate to a new page.
I lose the generic identity and all the roles.
Surely I don't need to go to the datastore each time i navigate to a
new page ?
Why aren't all my values of the GenericPrincipal which i attached in
My.user.Currentprincipal
saved for the user's ENTIRE SESSION ?

Thanks
Erick


Reply With Quote
  #2  
Old   
Dominick Baier
 
Posts: n/a

Default Re: GenericPrincipal - 09-12-2007 , 07:52 PM






You have to do that per request.

e.g. in global.asax in the PostAuthenticateRequest event. Be sure to set
HttpContext.Current.User *and* Thread.CurrentPrincipal.

For perf optimization, cache the roles using HttpContext.Current.Cache

-----
Dominick Baier (http://www.leastprivilege.com)

Developing More Secure Microsoft ASP.NET 2.0 Applications (http://www.microsoft.com/mspress/books/9989.asp)

Quote:
I'm trying to create a use a genericprincipal object with roles
authorization to use in my asp.net apps

My user directs new users to an asp.net login page.
They log in and I use that ifnormation to create a genericidentity.
Then i get their roles from the data store and use that and the
generic identity to create a genericprincipal object.
I then assign the genericprincipal object to the
My.User.CurrentPrincipal.
It all works fine up to this piont
The problem occurs when I navigate to a new page.
I lose the generic identity and all the roles.
Surely I don't need to go to the datastore each time i navigate to a
new page ?
Why aren't all my values of the GenericPrincipal which i attached in
My.user.Currentprincipal
saved for the user's ENTIRE SESSION ?
Thanks
Erick



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.