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.

>
EXPERT RESPONSE

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:


Sound Off! -   Be the first to post a message to Sound Off!


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


RELATED CONTENT
Application Security
PCI DSS compliance: WAF, code review or both?
Application security careers have bright future
How to prevent anti-DNS pinning attacks
Open source application security testing tools
Java application security features and measures
Web application security testing basics
Password recovery with .NET 2.O using C#
Free load and performance testing tools
The most effective time to do security testing
Finding backdoor threats within applications

Building security into the SDLC (Software development life cycle)
Web application security and the PCI DSS
PCI DSS compliance: Web application firewalls (WAFs)
PCI DSS compliance: The basics
PCI DSS compliance: Code review
PCI DSS compliance: WAF, code review or both?
Application security careers have bright future
Writing software requirements that address security issues
Software Security Engineering: A Guide for Project Managers -- Chapter 3, Requirements Engineering for Secure Software
PCI DSS compliance: Web application firewall or code review?
Application security enters uncharted regions

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

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

TechTarget Corporate Web Site  |  Media Kits  |  Reprints  |  Site Map




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