Home | Download | PDF | API | FAQ | Search | Feedback | History

> ## Securing Web Applications

> Web applications contain resources that can be accessed by many users. These resources often traverse unprotected, open networks, such as the Internet. In such an environment, a substantial number of web applications will require some type of security.

> The ways to implement security for Java EE applications are discussed in a general way in Securing Containers (page 870). This chapter provides more detail and a few examples that explore these security services as they relate to web components. Java EE security services can be implemented for web applications in the following ways:

> - Metadata annotations (or simply, annotations) are used to specify information about security within a class file. When the application is deployed, this information can either be used by or overridden by the application deployment descriptor.
> - Declarative security expresses an application's security structure, including security roles, access control, and authentication requirements in a deployment descriptor, which is external to the application.

> Any values explicitly specified in the deployment descriptor override any values specified in annotations.

> - Programmatic security is embedded in an application and is used to make security decisions. Programmatic security is useful when declarative security alone is not sufficient to express the security model of an application.

> Some of the material in this chapter assumes that you have read Chapter 28, "Introduction to Security in Java EE", therefore we recommend that you explore that chapter before beginning this one.

> This section assumes that you are familiar with the web technologies being discussed, or that you have read the following chapters in this tutorial that discuss these technologies:

> - Chapter 2, "Getting Started with Web Applications"
> - Chapter 4, "JavaServer Pages Technology"
> - Chapter 9, "JavaServer Faces Technology"
> - Chapter 28, "Introduction to Security in Java EE"