Home > Ask the Software Quality Experts > Application Security Questions & Answers > Access control and JSPs
Ask The Software Quality Expert: Questions & Answers
EMAIL THIS

Access control and JSPs

Ramesh Nagappan EXPERT RESPONSE FROM: Ramesh Nagappan

Pose a Question
Other Software Quality Categories
Meet all Software Quality Experts
Become an Expert for this site


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


>
QUESTION POSED ON: 22 February 2007
We are trying to do access control with JSPs (Java Server Pages), but we don't want to block access to everything. How do we do it so that some of the important info is hidden from some but not important things are available? Or is this even a good idea? We are new at this. Thank you.

>

Absolutely, it is very important to enforce controlled access to the deployed Web content and its associated resources based on user privileges and resource policies specified within your Java EE Web environment. In general, JSPs/Servlets (or Web components) adopt Java EE (J2EE) Web container role-based authorization mechanisms to restrict access control for Web components and their associated resources. Controlling access to resources from a JSP Web component can be done in several ways using both declarative and programmatic authorizations.

Declarative authorization uses the Web application deployment descriptor <security-constraint> element and its <auth-constraint> sub-element for determining who is authorized and to determine access protection of resources such as URL patterns and HTTP methods. These security constraints work only if the original Web application request URI initiated by the caller via a RequestDispatcher (which include <jsp:include> and <jsp:forward>). This means that the inside the Web application, the application has control over all required resources. It would not forward a user's request to access a resource unless the requesting user had privileges to access them. In addition, the Web container checks to see if the authenticated user belongs to one of the roles defined in the <auth-contraint> tag of the deployment descriptor. If the user does not belong to the specified roles for the resource, the request will be terminated with an error message.

Programmatic authorization uses selected methods in the HTTPServletRequest interface such as getRemoteUser(), IsUserInRole(role) and getUserPrincipal() methods for controlling access to Web resources. Programmatic access control is good for setting dynamic access control rules within a Web application, multi-role access and content-level authorization. It also can be mapped to the declarative mechanisms if the calling user is defined in the <role-name> element of the deployment descriptor. This helps to check whether the user access to the Web application is privileged to launch a specific role-based action or viewing content etc.

In addition to the above core authorization mechanisms, there are several design and implementation strategies for enforcing content-level authorization strategies using JAAS authorization, Filters and JSP Custom Tag libraries. I would also suggest taking a look at the Authorization Enforcer design pattern described in Core Security Patterns.

More information:


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Application Security
Expert resolves issues plaguing OpenSTA users
What is fuzz testing? What are some ways to use fuzz testing?
How do I convince management to take application security seriously?
How do I set up a secure login page using membership in ASP.NET?
Security testing sales, marketing websites
Are there application security certification standards?
Top tools for testing Web application security
How to prevent HTTP response splitting
PCI DSS compliance: WAF, code review or both?
Application security careers have bright future

Building security into the SDLC (Software development life cycle)
Problems caused by skipping analysis stage of SDLC
Inexpensive phase of SDLC to catch and fix bugs
GatherSpace beefs up cloud-based requirements management
ALM: Best of breed vs. complete systems
Software development life cycle phases, iterations, explained step by step
The role of quality assurance (QA) pros in software security
Common software security risks and oversights
Why the quality assurance department should be involved in testing
How to develop secure applications
Secure software development practices 'not rocket science'

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary



Search and Browse the Expert Answer Center
Search and browse more than 25,000 question and answer pairs from more than 250 TechTarget industry experts.
Browse our Expert Advice



Software Quality - Software Maintenance, Software Requirements, Software Standards
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 2006 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts