CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.security Tags:
Item Type: NewsGroup Date Entered: 9/18/2003 6:58:05 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 5 Views: 26 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
6 Items, 1 Pages 1 |< << Go >> >|
likwid
Asp.Net User
Role Based Security questions9/18/2003 6:58:05 PM

0/0


I have been thinking through authorization scenarios for the current application I am building. The requirements in this application call for a completely extendable, customizable architecture for just about everything. The entire site is themeable (different styles or methods of navigation) and skinnable (variations of color on preexisting theme designs). Another requirement I was tasked with is making the authentication (AuthN) and authorization (AuthZ) mechanism very flexible. While there are only a handful of roles defined today, there maybe more roles added in the future. Herein lays my problem?

I have pretty exhaustively (I think) studied how AuthZ works in the .Net framework. You can do checks configuratively, programmatically, imperatively, and declaratively. (Thanks to DNeimke for defining these examples in his article on 4GuysFromRolla.com ). I probably should preface this with saying I do know there are instances that role based security would be great to use. I am struggling with the maintainability of implementing pure role based security into my actual code.

Programmatic Authorization
Programmatically is a bit better, but not by much in my opinion. This method allows you to check to see if a user is in a specific role by accessing a user object or another object which implements IPrincipal interface. Simple call object.IsInRole(?Administrators?) and it will return true or false.

If Not (User.IsInRole("Public")) And Not (User.IsInRole("Other")) Then
' Display the link
Else
' Don't display it
End If

The problem I see with this (and many of the other options), I am required to code against the set of roles already defined, and not for the possible future roles. I am sure I could come up with a generic function to check if the user is in a collection of roles that I get from a database. I would still have to maintain a page table with a relationship to the roles that would specify which roles belonged to which page. I would rather do the role checking at the database as that point. A simple query could tell me if the user is in a role that has access to a specific page. This also still doesn?t cover task based security which is a more likely scenario for web based applications. For those scenarios you would be forced to use imperative or declarative based authorization.

Imperative Authorization
This method allows you to create an instance of the PrincipalPermission class and demand the permissions before attempting to perform the action. If the current user does not have the permission necessary, a SecurityException will be thrown.

Dim objPermission As New PrincipalPermission(User.Identity.Name, "manager")
Try
objPermission.Demand()
Catch ex As SecurityException
' Don't display it
End Try

I can see how this could be useful in a small application, but you would most likely repeat this code over and over in a larger application. I suppose I would be able to write a sub procedure that accepts a collection of allowed roles and iterate the collection, demanding permission for each role as I go. Again, this doesn?t seem worth it when I can just compare some values in the database and return a simple 1 or 0 in a return value from a stored procedure.

Declarative Authorization
This method involves using attributes to define the authorization requirements for particular methods in a class. The PrincipalPermissionAttribute is used to define which users or roles are allowed access, and what type of security action can be performed.

' Create a method that disables all moderator permissions
' and attach a PrincipalPermissionAttribute to it that issues
' a Demand.
Public Sub DismissModerator()
' logic hereEnd Sub
Try
DismissModerator()
Catch ex As SecurityException
' do something else
End Try

This would be great if my roles were clearly defined and indelible. I do not see how this method would allow me to compensate for database driven roles.

None of the scenarios above are equipped to handle the requirements of my application. I can see if I was using Windows Security how role based security would help. I definitely understand how I can use role based security to my advantage when deploying assemblies into com+ using Enterprise Services. All of these depend on a set of clearly defined, unchanging roles, and maybe that is part of my problem. I am very open to suggestions on how to use the existing framework options for my application (if possible). For now the only method I can see to accomplish my goals are by using the database layer only.

The method I am using to handle authorization with the database, is by storing the page name in a table and relating it to a table of roles that are allowed to access the page. Anytime a request is made for a specific page, I will get the user?s email address out of the FormsAuthenticationTicket, verify that they are a valid user, and then determine through a joined query whether they have access to the page via the allowed roles.

I do not know if this is the best possible way, but I guess that is the question I am posing. I would like to know how other people are conquering this same problem.
donkiely
Asp.Net User
Re: Role Based Security questions9/18/2003 8:11:06 PM

0/0

Very interesting post. Thanks for sharing your thoughts! I hope that it generates some discussion, because these are such important considerations for .NET apps. Well, and all software today.

I've found that for maximum flexibility in apps I need to do pretty much what you describe in the last part of your post. It can be effective to use the other methods in conjunction with a database approach, but it's also very easy to introduce security holes.

So I generally use declarative security for the big picture, the overall access to the app. Then I usually have some generic code that hooks into the programmatic and/or imperative technique based on the needs of the application. But within those, I put the specifics in a database so that they are easy to modify without compiling code.

One thing to be careful of is overtaxing the database. I would guess that you could make the process more granular than you describe by storing some state so that you don't have to validate the user on every postback. Depending on the site, that could easily overload the system.

Can you make it more granular? Maybe by grouping pages functionally and saving a token in a session variable once the user is authorized for that group of pages? I've seen apps where it really had to be on a page by page basis, but fortunately those are relatively rare.

Don
Don Kiely, MCP, MCSD
In the Last Frontier, Interior Alaska
Please post questions and replies to the forum! And remember to MARK AS ANSWER when someone definitively answers a question or resolves a problem!
likwid
Asp.Net User
Re: Role Based Security questions9/18/2003 8:26:49 PM

0/0

donkiely, thanks for your reply.

I guess my justification for touching the database every time a page is requested is twofold.

For one, I do not want the ability to cache or store state relating to security in any way, shape or form. To me this is a security risk, even if a very rare one.

Secondly, our application is completely customizable in every way. It is fully themeable, skinnable and every piece of information is editable in some respect in the admin tool. Since the authorization framework I am discussing is for our admin tool, the data perf hit is not such a big deal to me. It will have far less traffic than the sites that are being driven by the data.
donkiely
Asp.Net User
Re: Role Based Security questions9/18/2003 9:09:33 PM

0/0

Good reasons all. You're being a bit paranoid, which is a very healthy characteristic of a security-conscious developer.

Don
Don Kiely, MCP, MCSD
In the Last Frontier, Interior Alaska
Please post questions and replies to the forum! And remember to MARK AS ANSWER when someone definitively answers a question or resolves a problem!
likwid
Asp.Net User
Re: Role Based Security questions9/19/2003 5:44:12 AM

0/0

A good friend of mine Rob Chartier(http://weblogs.asp.net/rchartier) came up with a solution that I think might be pretty good. Basically instead of storing the page name in the database, I could mark sections of my code, such as a whole page or a particular method as a "section" of code. I could store the name for this "section" in the database and use a method such as CheckSecurity(currentUser, "SECTIONNAME") to verify if the user has access the particular section of code. This does seem to be more flexible since I can control the section's of code with any boundry I see fit. I was really hoping the ASP.NET team might weigh in on this issue, so if anyone is listening... =)
donkiely
Asp.Net User
Re: Role Based Security questions9/19/2003 4:47:12 PM

0/0

Wow. That's REALLY getting granular. You really have a need for that? Wow. I hope that it's a maintainable solution. Do you have a link on the blog where he describes it? I didn't see it.

Thanks,
Don
Don Kiely, MCP, MCSD
In the Last Frontier, Interior Alaska
Please post questions and replies to the forum! And remember to MARK AS ANSWER when someone definitively answers a question or resolves a problem!
6 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
MCSE 70-293 Training Guide: Planning and Maintaining a Windows Server 2003 Network Infrastructure Authors: Will Schmied, Robert Shimonski, Dave Bixler, Ed Tittel, Pages: 736, Published: 2003
.NET Framework Solutions: In Search of the Lost Win32 API Authors: John Mueller, Pages: 562, Published: 2002
Data and Applications Security: Developments and Directions : IFIP TC11 WG11.3 Fourteenth Annual Working Conference on Database Security, Schoorl, The Netherlands, August 21-23, 2000 Authors: Bhavani M. Thuraisingham, Reind van de Riet, Klaus R. Dittrich, Pages: 376, Published: 2001
Information Security Management Handbook: Vol. 3 Authors: Harold F. Tipton, F. Tipton, Micki Krause, Pages: 686, Published: 2006
C# COM+ Programming Authors: Derek Beyer, Pages: 287, Published: 2001
Beginning ASP.NET 3.5 in C# 2008: From Novice to Professional Authors: Matthew MacDonald, Pages: 954, Published: 2007
Visual Studio Tools for Office: Using Visual Basic 2005 with Excel, Word, Outlook, and InfoPath Authors: Eric Carter, Eric Lippert, Pages: 992, Published: 2006
Securing Electronic Business Processes Highlights of the Information Security Solutions Europe 2006 Conference Authors: 2006 ISSE (8, Roma, Pages: 0, Published: 2006
Policies for Distributed Systems and Networks: International Workshop, POLICY 2001, Bristol, UK, January 29-31, 2001 : Proceedings Authors: Morris Sloman, Jorge Lobo, Emil C. Lupu, Pages: 261, Published: 2001

Web:
Role Based Security questions - ASP.NET Forums Role Based Security questions. Last post 09-19-2003 12:47 PM by donkiely. 5 replies. Sort Posts:. Oldest to newest, Newest to oldest ...
ASP.NET 1.1 Active Directory Role Based Security Question Talk about ASP.NET 1.1 Active Directory Role Based Security Question.
threading and Principal question - from Role-based security to ... threading and Principal question - from Role-based security to declarative security.. Get answers to your questions in our .NET C# forum.
MSDN Common Language Runtime A Newbie Question to .NET Role Based ... A Newbie Question to .NET Role Based Security. Dear Thomas Cheah,. Here are some classic example of implementation role based security in .NET. ...
Re: Role-based security question - Vamsavardhana Reddy - org ... geronimo.apache.org Date: Mon, 7 Aug 2006 10:50:17 +0200 (CEST) Subject: Role- based security question Hallo Geronimo users, ...
Questionmark - Windows Based Authoring You can use simple drag & drop and cut & paste commands to manage questions, assessments, and supporting content. Role-based Security for Collaborative, ...
CodeProject: .NET Role-Based Security in a Production Environment ... May 19, 2008 ... Many have asked the question, “My ASP application uses role-based security, and it works well on my ‘localhost’ with SQL Server 2005 Express ...
Role Based Security in .NET I'd be willing to BET that's faster than role - based security under COM+, and I doubt there is any question that deployment and maintenance are much ...
Selling Role-Based Security When you decide to implement role-based security in your organization, it helps to predict the questions that decision makers will have about the shift.
StrataFrame Forum All Role Based Security related questions and comments. ... Questions regarding the use of the Database Deployment Toolkit including using the Meta-Data ...

Videos:
Charlie Rose - Brian Ross / Syria's role in the Mid-East / YouTube co-founders Segment 1: The latest on the disrupted terrorist plot in London with Brian Ross of ABC News. Segment 2: A discussion about the role of Syria in th...
(Pt.2) What About the Black Community, OBAMA? ST. PETERSBURG, FL — On Friday, August 1, the Barack Obama presidential campaign hit a serious bump in a St. Petersburg, Florida town hall meeting as...
Asking the Right Questions: An Introduction to the Centre for Micro Finance Due to tremendous growth in the microfinance industry, the Centre for Micro Finance (CMF) was created to ask and answer the most fundamental question...
Presidential debate #2 reaction: That One???!? In Debate II, John McCain twice laid out the criteria for how the American people should judge the candidates: In tough times, we need someone with a...
25 Bill Risner Closing Argument Pima County Election Integrity Trial Arizona The central theme of Democrats' attorney Bill Risner throughout the trial was that the elections belong to the people, not the government. The peopl...
Ivan Canas: Quite Right Medvedev!! Georgia's attack was Russia's 9/11. Please read the 'more info' section Foreign political experts continue travelling across Russia - talking with the country's top officials. From Chechnya to Rostov-on-Don, then to Sochi...
(Pt.1) What About the Black Community, OBAMA? ST. PETERSBURG, FL — On Friday, August 1, the Barack Obama presidential campaign hit a serious bump in a St. Petersburg, Florida town hall meeting as...
Is Sarah Palin a stealth Dick Cheney clone? Another legitimate question: does Palin believe that the vice-presidency belongs to both the executive and the legislative branch, as Cheney did? Aft...
How To Break Web Software - A look at security vulnerabilities in web software Google TechTalks April 13, 2006 Mike Andrews Mike Andrews is a senior consultant who specializes in software security and leads the web application...
Two US Congressmen against anti-Macedonian S. Resolution 300 05.10.07 US-Congressmen, Bill Pascrell (D-NJ) and Mark E. Souder (R-IN), voiced their opinions on Macedonia Name Issue and their opposition to House ...




Search This Site:










dnn doesn't support dhtml?

sorting datatable when manually adding rows

can i host invididual web applications in sub domains?

namespace

hide source code while deploying

how to access posted form data in code behind c#

develop asp.net on remote machine

removing edit verb/custom edit verb

problems with community/forums on dnn.com

how to launch .exe file that uses command line in asp?

using/loading an outside application

server control calls web service with authentication

checking for null

problem with register page

upgrade: 2.1.2 to 3.1.1. old web.config has no machine-key values.

calendar control asp.net example is not working

html editor for 2.1.2 that works in firefox

web page do not show controls in design time

enter key outside a textbox

future autonumber fields during an insert

where is editurl code

development server vs. iis - help

dnn not working with framework 1.1

how to take row in gridview

content management of

best method

switching off treeview node navigate to url

creating a module

session and forms timeouts

calendar pro 1.8 killed my site! help!

 
All Times Are GMT