|By Duncan Mills, Frank Nimphius||
|August 10, 2006 05:15 PM EDT||
Application security - the art of applications defending themselves - represents an important line of defence in an overall in-depth security strategy. Web applications that follow the Model-View-Controller (MVC) architecture can, and should, have security implemented on all three layers. Normally it's the controller component that handles page authorization in MVC, the view layer that hides controls and information based on user authorization, and the model that enforces the business rules and input validation. However, it's up to the developer, based on an individual security policy and the programming technology used, to decide where to put security. Using pluggable validator components in JavaServer Faces (JSF), for example, developers may decide to verify user input on the view layer as well as on the model layer.
JavaServer Faces, the new J2EE standard for building feature-rich Web applications with JEE 1.5, has few integrated security features. JSF generously delegates the task of implementing application security such as page authorization to the application developer, leaving many developers pondering where to start, where best to put security, and which security technology to choose.
This article aims to answer such questions for authorization in JavaServer Faces, demonstrating how a custom PhaseListener that uses J2EE container-managed security can be used to implement access control for JSF pages. Besides page authorization, the security PhaseListener supports protocol switching between HTTP and HTTPS, a common requirement of applications that work with sensitive data on a Web page.
The J2EE Security Choices
The J2EE platform provides two built-in security technologies for the application developer to use: the Java Authentication and Authorization Service (JAAS) and container-managed security, also known as J2EE security.
The Java Authentication and Authorization Service is a J2SE 1.4 security standard designed for the Java desktop that's also used as an implementation technology for security in J2EE. The JAAS authentication infrastructure is built as a Java version of the Pluggable Authentication Module (PAM) architecture that allows one or more authentication providers to be used for user identification. Before JAAS, the Java 2 security platform was code-centric, determining access privileges based solely on the location of the Java sources. Using JAAS, Java security now also looks at the authenticated user when evaluating access control to resources. JAAS's benefit is its ability to implement fine-grained access control through external Java permission classes, which associate users with a list of resources and allowed actions.
Authentication and authorization in J2EE security is configured declaratively in the application's web.xml deployment descriptor and handled by the J2EE container at runtime. Working with APIs defined in the J2EE servlet standard, application developers don't have to worry about the implementation of security in a container. In container-managed security, authorization is enforced on URL patterns, which are absolute or relative URLs. This however also means that authorization is only enforced on requests that are initiated by the client, not as server-side forward requests.
Ease of use, the clean separation of security definition and application code, and portability across application servers are the main reasons for the wide adoption of container-managed security among business application developers. J2EE security is sufficient to implement many common security use cases. As a reflection of its popularity and its portability, container-managed security is used in the code examples of this article to illustrate effective page authorization in JavaServer Faces.
Container-Managed Security in J2EE
In container-managed security, a user is granted access to protected URL resources through security roles defined in the web.xml deployment descriptor. Security roles in J2EE are logical names used in Web applications that are mapped during or after deployment to user groups that exist on the target application server platform.
Listing 1 Web.xml excerpt granting the app_user security role access to the protected URL resource /faces/protected/*
To access a protected application resource, Web application users must first authenticate, which in container-managed security is handled by the J2EE container. Either the application developer or the application deployer configures the type of authentication in the web.xml deployment descriptor.
Listing 2 Basic authentication defined for the jazn.com realm
To check authorization programmatically in an J2EE application - like in JavaServer Faces - application developers use the isUserInRole method in the servlet API. This isUserInRole method is also exposed via a convenience method in JavaServer Faces through the static FacesContext class. Role names referenced in application code ought to be mapped to roles defined in the web.xml file using the <security-role-ref> element if the role names don't match. Using the <security-role-ref> element, developers don't have to be aware of the security role names that exist in the web.xml descriptor when developing an application.
Listing 3 Mapping the "user" role name used in the application code to the security role name "manager_role" defined in the web.xml file
If the authenticated user isn't authorized to access the requested URL resource, the J2EE container responds with HTTP error 403, indicating a bad request. A HTTP error 401 is returned if a user cancels the authentication process. HTTP error codes and Java exceptions are handled declaratively in the web.xml file using the <error-page> element.
Listing 4 Redirecting a request in response to unauthorized page access handling error code 403 and 401
If SSL is required to ensure secure communication when accessing a specific Web resource, the <security-constraint> element added for a protected resource contains an additional <user-data-constraint> element. Setting the transport guarantee to "confidential" indicates that SSL is required.
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life sett...
Jun. 25, 2016 06:15 PM EDT Reads: 963
There are several IoTs: the Industrial Internet, Consumer Wearables, Wearables and Healthcare, Supply Chains, and the movement toward Smart Grids, Cities, Regions, and Nations. There are competing communications standards every step of the way, a bewildering array of sensors and devices, and an entire world of competing data analytics platforms. To some this appears to be chaos. In this power panel at @ThingsExpo, moderated by Conference Chair Roger Strukhoff, Bradley Holt, Developer Advocate a...
Jun. 25, 2016 05:00 PM EDT Reads: 643
Cognitive Computing is becoming the foundation for a new generation of solutions that have the potential to transform business. Unlike traditional approaches to building solutions, a cognitive computing approach allows the data to help determine the way applications are designed. This contrasts with conventional software development that begins with defining logic based on the current way a business operates. In her session at 18th Cloud Expo, Judith S. Hurwitz, President and CEO of Hurwitz & ...
Jun. 25, 2016 03:00 PM EDT Reads: 1,502
In his general session at 18th Cloud Expo, Lee Atchison, Principal Cloud Architect and Advocate at New Relic, discussed cloud as a ‘better data center’ and how it adds new capacity (faster) and improves application availability (redundancy). The cloud is a ‘Dynamic Tool for Dynamic Apps’ and resource allocation is an integral part of your application architecture, so use only the resources you need and allocate /de-allocate resources on the fly.
Jun. 25, 2016 02:15 PM EDT Reads: 996
A strange thing is happening along the way to the Internet of Things, namely far too many devices to work with and manage. It has become clear that we'll need much higher efficiency user experiences that can allow us to more easily and scalably work with the thousands of devices that will soon be in each of our lives. Enter the conversational interface revolution, combining bots we can literally talk with, gesture to, and even direct with our thoughts, with embedded artificial intelligence, wh...
Jun. 25, 2016 01:45 PM EDT Reads: 855
19th Cloud Expo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy. Meanwhile, 94% of enterpri...
Jun. 25, 2016 01:15 PM EDT Reads: 1,189
SYS-CON Events announced today that Bsquare has been named “Silver Sponsor” of SYS-CON's @ThingsExpo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. For more than two decades, Bsquare has helped its customers extract business value from a broad array of physical assets by making them intelligent, connecting them, and using the data they generate to optimize business processes.
Jun. 25, 2016 11:45 AM EDT Reads: 1,149
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with 19th Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world. The Internet of Things (IoT) is the most profound change in personal and enterprise IT since the creation of the Worldwide Web more than 20 years ago. All major researchers estimate there will be tens of billions devices - comp...
Jun. 25, 2016 11:15 AM EDT Reads: 1,151
Machine Learning helps make complex systems more efficient. By applying advanced Machine Learning techniques such as Cognitive Fingerprinting, wind project operators can utilize these tools to learn from collected data, detect regular patterns, and optimize their own operations. In his session at 18th Cloud Expo, Stuart Gillen, Director of Business Development at SparkCognition, discussed how research has demonstrated the value of Machine Learning in delivering next generation analytics to imp...
Jun. 25, 2016 11:00 AM EDT Reads: 465
There is little doubt that Big Data solutions will have an increasing role in the Enterprise IT mainstream over time. Big Data at Cloud Expo - to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA - has announced its Call for Papers is open. Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is...
Jun. 25, 2016 11:00 AM EDT Reads: 1,273
The 19th International Cloud Expo has announced that its Call for Papers is open. Cloud Expo, to be held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, brings together Cloud Computing, Big Data, Internet of Things, DevOps, Digital Transformation, Microservices and WebRTC to one location. With cloud computing driving a higher percentage of enterprise IT budgets every year, it becomes increasingly important to plant your flag in this fast-expanding business opportuni...
Jun. 25, 2016 10:30 AM EDT Reads: 1,216
Cloud computing is being adopted in one form or another by 94% of enterprises today. Tens of billions of new devices are being connected to The Internet of Things. And Big Data is driving this bus. An exponential increase is expected in the amount of information being processed, managed, analyzed, and acted upon by enterprise IT. This amazing is not part of some distant future - it is happening today. One report shows a 650% increase in enterprise data by 2020. Other estimates are even higher....
Jun. 25, 2016 10:15 AM EDT Reads: 1,209
The cloud market growth today is largely in public clouds. While there is a lot of spend in IT departments in virtualization, these aren’t yet translating into a true “cloud” experience within the enterprise. What is stopping the growth of the “private cloud” market? In his general session at 18th Cloud Expo, Nara Rajagopalan, CEO of Accelerite, explored the challenges in deploying, managing, and getting adoption for a private cloud within an enterprise. What are the key differences between wh...
Jun. 25, 2016 10:00 AM EDT Reads: 651
Internet of @ThingsExpo, taking place November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA, is co-located with the 19th International Cloud Expo and will feature technical sessions from a rock star conference faculty and the leading industry players in the world and ThingsExpo Silicon Valley Call for Papers is now open.
Jun. 25, 2016 09:30 AM EDT Reads: 1,077
It is one thing to build single industrial IoT applications, but what will it take to build the Smart Cities and truly society changing applications of the future? The technology won’t be the problem, it will be the number of parties that need to work together and be aligned in their motivation to succeed. In his Day 2 Keynote at @ThingsExpo, Henrik Kenani Dahlgren, Portfolio Marketing Manager at Ericsson, discussed how to plan to cooperate, partner, and form lasting all-star teams to change t...
Jun. 25, 2016 07:45 AM EDT Reads: 1,034
Connected devices and the industrial internet are growing exponentially every year with Cisco expecting 50 billion devices to be in operation by 2020. In this period of growth, location-based insights are becoming invaluable to many businesses as they adopt new connected technologies. Knowing when and where these devices connect from is critical for a number of scenarios in supply chain management, disaster management, emergency response, M2M, location marketing and more. In his session at @Th...
Jun. 25, 2016 07:30 AM EDT Reads: 857
SYS-CON Events announced today that ReadyTalk, a leading provider of online conferencing and webinar services, has been named Vendor Presentation Sponsor at the 19th International Cloud Expo, which will take place on November 1–3, 2016, at the Santa Clara Convention Center in Santa Clara, CA. ReadyTalk delivers audio and web conferencing services that inspire collaboration and enable the Future of Work for today’s increasingly digital and mobile workforce. By combining intuitive, innovative tec...
Jun. 24, 2016 01:00 PM EDT Reads: 1,326
Amazon has gradually rolled out parts of its IoT offerings, but these are just the tip of the iceberg. In addition to optimizing their backend AWS offerings, Amazon is laying the ground work to be a major force in IoT - especially in the connected home and office. In his session at @ThingsExpo, Chris Kocher, founder and managing director of Grey Heron, explained how Amazon is extending its reach to become a major force in IoT by building on its dominant cloud IoT platform, its Dash Button strat...
Jun. 24, 2016 12:00 PM EDT Reads: 1,582
industrial company for a multi-year contract initially valued at over $4.0 million. In addition to DataV software, Bsquare will also provide comprehensive systems integration, support and maintenance services. DataV leverages advanced data analytics, predictive reasoning, data-driven diagnostics, and automated orchestration of remediation actions in order to improve asset uptime while reducing service and warranty costs.
Jun. 22, 2016 11:00 AM EDT Reads: 1,348
Vidyo, Inc., has joined the Alliance for Open Media. The Alliance for Open Media is a non-profit organization working to define and develop media technologies that address the need for an open standard for video compression and delivery over the web. As a member of the Alliance, Vidyo will collaborate with industry leaders in pursuit of an open and royalty-free AOMedia Video codec, AV1. Vidyo’s contributions to the organization will bring to bear its long history of expertise in codec technolo...
Jun. 19, 2016 12:45 PM EDT Reads: 1,241