473,657 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

WindowsAuthenti cation_Authenti cate Customer Roles and Impersonation

I'd like to create customer roles for my ASP.Net application, but I am
also using impersonation. For the purposes of this issue, say I have
the simple code below for my custom roles.:

Overrides Sub Init()
_ht = New Hashtable
_ht.Add("mycomp uter/me", New String() {"ViewAll",
"ViewPublished" })
End Sub
Sub WindowsAuthenti cation_Authenti cate(ByVal s As Object, ByVal e As
WindowsAuthenti cationEventArgs )
e.User = New GenericPrincipa l(e.Identity, _ht("mycomputer/me"))
End Sub

The problem is that I don't have access to the custom roles in my page
code. I've read that this has something to do w/ impersonation
happening after the WindowsAuthenti cation_Authenti cate method is
called. The problem is that the User object seems to be read only
after this, so in what method can I assign these custom roles?

Thanks
-j

Jan 2 '06 #1
3 1570
Jeff,
At first blush it appears you are attempting to have your cake and eat it
too. The whole concept of authentication is to create a custom Identity based
on the user's credentials, no? In this case you are forcing it to be
"mycomputer/me"... no matter who it is.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jeff Deville" wrote:
I'd like to create customer roles for my ASP.Net application, but I am
also using impersonation. For the purposes of this issue, say I have
the simple code below for my custom roles.:

Overrides Sub Init()
_ht = New Hashtable
_ht.Add("mycomp uter/me", New String() {"ViewAll",
"ViewPublished" })
End Sub
Sub WindowsAuthenti cation_Authenti cate(ByVal s As Object, ByVal e As
WindowsAuthenti cationEventArgs )
e.User = New GenericPrincipa l(e.Identity, _ht("mycomputer/me"))
End Sub

The problem is that I don't have access to the custom roles in my page
code. I've read that this has something to do w/ impersonation
happening after the WindowsAuthenti cation_Authenti cate method is
called. The problem is that the User object seems to be read only
after this, so in what method can I assign these custom roles?

Thanks
-j

Jan 2 '06 #2
Hi Peter, Thank you for the reply. You're quite right of course, I
created this code in a overly-simplistic manner to try to isolate the
source of error to the custom role assignment. While it appears that
the roles are assigned successfully in the
WindowsAuthenti cation_Authenti cate method, these roles are not
available from the page. (Once this problem is complete, I'll be
supplying the roles from a database, and using the user's identity as
the index into the data)

Thanks Peter.

Peter Bromberg [C# MVP] wrote:
Jeff,
At first blush it appears you are attempting to have your cake and eat it
too. The whole concept of authentication is to create a custom Identity based
on the user's credentials, no? In this case you are forcing it to be
"mycomputer/me"... no matter who it is.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Jeff Deville" wrote:
I'd like to create customer roles for my ASP.Net application, but I am
also using impersonation. For the purposes of this issue, say I have
the simple code below for my custom roles.:

Overrides Sub Init()
_ht = New Hashtable
_ht.Add("mycomp uter/me", New String() {"ViewAll",
"ViewPublished" })
End Sub
Sub WindowsAuthenti cation_Authenti cate(ByVal s As Object, ByVal e As
WindowsAuthenti cationEventArgs )
e.User = New GenericPrincipa l(e.Identity, _ht("mycomputer/me"))
End Sub

The problem is that I don't have access to the custom roles in my page
code. I've read that this has something to do w/ impersonation
happening after the WindowsAuthenti cation_Authenti cate method is
called. The problem is that the User object seems to be read only
after this, so in what method can I assign these custom roles?

Thanks
-j


Jan 2 '06 #3
Thoughts anyone?

Jan 3 '06 #4

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

Similar topics

12
2562
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The problem is that even when it is configured to run under a certain identity through Web.config, the impersonation is not carried through to COM library. Consequently, the code in COM object runs under a local account and any code that needs to access...
4
2183
by: Chris Gatto | last post by:
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...
3
1929
by: Sharat Koya | last post by:
Please can you help with a problem I am having. My web config is set to... <authorization><deny users="?"/> <authentication mode="Forms"> <forms name=".COOKIE" loginUrl="login.aspx" protection="All" timeout="5" path="/"/> </authentication> <identity impersonate="true"/>
5
2134
by: hansiman | last post by:
Following http://aspnet.4guysfromrolla.com/articles/082703-1.aspx I've set up roles authentication for my web application. User's roles are registered by: HttpContext.Current.User = _ New GenericPrincipal(User.Identity, roleListArray) I'd like to enter a user's roles into a listbox for viewing.
0
1029
by: Erland Sommarskog | last post by:
My article on dynamic SQL, "The Curse and Blessings of Dynamic SQL" is frequently referred to in these newsgroups. I like to announce that I have rewritten this article thoroughly. I started off with revising it for SQL 2005, but the more I looked at it, I felt that it was time for a major overhaul. After all, I wrote the initial version with a mindset of SQL 6.5. The URL is the same: http://www.sommarskog.se/dynamic_sql.html. At the...
9
4273
by: Mike Hofer | last post by:
BACKGROUND: We've designed a Website for a client that will be deployed across multiple physical locations. The site will be hosted from a corporate NOC, and administered by the IT group there. The site's end-users tend to fill each others' roles on a pretty frequent basis. Their permissions in the system have to be extremely flexible. We initially wanted to use role-based security, defining concrete roles, but when we realized how these...
0
1147
by: Nick | last post by:
I am working on a web based application in which all "roles" are stored in the database. When a user logs in their roles are then transferred to a comma delemited string, saved to a cookie, etc... On one method I have the following <PrincipalPermission(SecurityAction.Demand, Authenticated:=True, Role:="manageProspects")> _ Public Sub Add(prospect As MarketingProspect) In rare cases we have found there my be an issue adding data so we...
3
1282
by: John Chapman | last post by:
Hello, I am trying to use an Access database as the provider for the ASP.NET Membership for the users, roles, and profiles. I have looked at many tutorials available online, and I could not come up with a solution for everything. I need to know how to setup the tables within the database and then make it the provider. I am using C# on VS 2005. Any and all help would be appreciated. Thanks,
0
2691
by: sidhuasp | last post by:
Hi everyone I am using a mainmenu witeh sitemap provider with folowing sitemap <siteMapNode> <siteMapNode url="" title="Master Data" description="Enter Master data" roles ="Admin,PM"> <siteMapNode url="~/PL/Master/ViewProjects.aspx" title="Projects" description="View/Add Projects" roles ="Admin,PM" /> <siteMapNode url="~/PL/Master/AssignProject.aspx" title="Assign Project" description="Enter User Details details" roles...
0
8392
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7324
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1611
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.