SlideShare a Scribd company logo
Web Component Development
with Servlet & JSP Technologies
(EE 6)
Module-12: Implementing Security
Objectives
Upon completion of this module, you should be able
to:
● Describe a common failure mode in security
● Require that a user log in before accessing specific
pages in your web application
● Describe the Java EE security model
● Require SSL encrypted communication for certain
URLs or servlets
Relevance
Discussion – The following question is relevant to
understanding what technologies are available for
developing web applications and the limitations of
those technologies:
● If your application uses data that are private to your
company or your users, how can you be sure that
malicious users cannot inappropriately access or
modify those data?
Security
Considerations
Every application that is accessible over the web must consider
security. Your site must be protected from attack, the private data of
your site’s users must be kept confidential, and your site must also
protect the browsers and computers used to access your site.
This module introduces the following kwy points:
● Confusion of code and data
● Encryption of data in transit over the network
● Authentication and authorization of users
Confusion of Code and
Data: SQL Injection
Example
Your application might take the text of the item code, provided by the
user, and paste it into an SQL statement like this:
SELECT count from ITEMTABLE where itemcode=”XXXXXX”;
In this case, the XXXXXX would be replaced using the data provided
by the user in the field of the form.
This looks fine so far, but consider what happens if the user provides
the following as the itemCode field in the form:
unk”; DROP TABLE ITEMTABLE;
Confusion of Code and
Data: SQL Injection
Example
Now the result of pasting this “data” into the query is this:
SELECT count from ITEMTABLE where itemcode=”unk”; DROP
TABLE ITEMTABLE;”;
Authentication and
Authorization
The application usually needs to be able to identify the user, decide
what operations the user is allowed to perform, and maintain the
confidentiality and the integrity of the data that is in transit.
Authentication and
Authorization
Authentication and
Authorization
Authenticating the
Caller
Caller authentication is the process of verifying what the user’s
identity is, and consists of the following two steps.
● Determine the identity claimed by the user
● Verify that the user is who they claim to be (Authenticate the user)
Establishing User
Identities
The process of caller authentication requires that users of an
application be known in advance to the security system. The Java EE
specification recognizes the following two types of user identities:
● Principals: A principal is an authenticated user in the application
security domain. That is, a principal is identifyable to, and can be
authenticated by, a JAAS authentication mechanism deployed in
the web container.
● Roles: When writing an application, the users, and the principals to
which they will map, are usually not known. Nevertheless, you
must design a security model that will specify that certain
categories of user will have certain rights and be denied other
rights.
Examining the Java EE
Authorization Strategies
● The primary purpose of the Java EE security model is to control
access to business services and resources in the application.
● The Java EE security model provides two complementary
strategies for access control:
● Programmatic access control and declarative access control.
● Both strategies assume that the user has been authenticated by
the application server, and the roles of which the user is a
member can therefore be determined by the web container.
Using Declarative
Authorization
Declarative authorization for web applications involves the following
Tasks:
● Collection of user credentials into a credentials database
● Declaration of roles
● Mapping users to roles
● Specification of role requirements for access to URLs
Creating a
Credential Database
Creating the collection of user credential is entirely dependent on
the web containerin use. The lab for tis module will show you the
most basic way to achieve this in Netbeans/ Glassfish you are using.
Declaring Security
Roles
Security roles are declared in the web.xml deployment descriptor,
using the <security-role> element.
This element lives at the first level of the web.xml file, as a direct
child of the <web-app> element.
<security-role>
<description>...</description>
<role-name>...</role-name>
</security-role>
Mapping Users to
Roles
<security-role-mapping>
<role-name>Customer</role-name>
<principal-name>Alice</principal-name>
<principal-name>Maverick</principal-name>
</security-role-mapping>
Using Programmatic
Authorization
Programmatic authorization is the responsibility of the bean
developer.
The following methods in the HttpServletRequest support
programmatic authorization:
● boolean isUserInRole(String role)
● Principal getUserPrincipal()
● Programmatic authorization is more expressive than the
declarative approach, but is more cumbersome to maintain, and
because of the additional complexity, more error prone.
Enforcing Encrypted
Transport
Provided the server has been configured with a public key
certificate, you can require that communication between client and
server be encrypted.
In this case, an additional element, <user-data-constraint> will be
added in the web.xml file
Web Stack Academy (P) Ltd
#83, Farah Towers,
1st floor,MG Road,
Bangalore – 560001
M: +91-80-4128 9576
T: +91-98862 69112
E: info@www.webstackacademy.com
www.webstackacademy.com

More Related Content

PPTX
Secure Code Warrior - NoSQL injection
PPTX
Secure Code Warrior - XQuery injection
PPTX
Secure Code Warrior - Insufficient data encoding
PPTX
Windows Identity Foundation
PPTX
SCWCD : Secure web
PPTX
Sql injection
PPTX
Authentication and Authorization in Asp.Net
PPTX
ASP.NET Web Security
Secure Code Warrior - NoSQL injection
Secure Code Warrior - XQuery injection
Secure Code Warrior - Insufficient data encoding
Windows Identity Foundation
SCWCD : Secure web
Sql injection
Authentication and Authorization in Asp.Net
ASP.NET Web Security

What's hot (18)

PPTX
Secure Code Warrior - Least privilege
PPT
Web security 2010
PPTX
Secure Code Warrior - Trust no input
PPT
Mule security - authorization using spring security
PDF
Design and Configuration of App Supportive Indirect Internet Access using a ...
PPTX
Web authentication & authorization
PPTX
Sql security
PDF
Database security issues
PDF
IRJET - SQL Injection: Attack & Mitigation
PDF
Web Programming - 12 Authentication and Authorization
PPTX
Owasp web security
PPTX
Box Authentication Types
DOC
Joomla web application development vulnerabilities
PPTX
Code injection
PPTX
Silverlight in Action
PPT
Mule security-jaas
PPTX
Sql injections (Basic bypass authentication)
PDF
Broken access control
Secure Code Warrior - Least privilege
Web security 2010
Secure Code Warrior - Trust no input
Mule security - authorization using spring security
Design and Configuration of App Supportive Indirect Internet Access using a ...
Web authentication & authorization
Sql security
Database security issues
IRJET - SQL Injection: Attack & Mitigation
Web Programming - 12 Authentication and Authorization
Owasp web security
Box Authentication Types
Joomla web application development vulnerabilities
Code injection
Silverlight in Action
Mule security-jaas
Sql injections (Basic bypass authentication)
Broken access control
Ad

Similar to Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 12 - Implementing Security (20)

PPTX
SCWCD : Secure web : CHAP : 7
PDF
Bluedog white paper - Our WebObjects Web Security Model
PPTX
Spring Security services for web applications
PPTX
AbedElilahElmahmoumP1.pptx
PPTX
Web security
PDF
Secure coding presentation Oct 3 2020
PDF
IRJET- Privacy Preserving and Proficient Identity Search Techniques for C...
PPT
ppt.ppt
PPTX
Cloud Identity Management
PPTX
Authentication and Authorization in jaipur
PPTX
Final PPT after cla after class (1).pptx
PPT
Step by step guide for web application security testing
PDF
Spring security jwt tutorial toptal
PDF
OWASP-top 10 Compliance checklist -.56854.pdf
DOCX
Security Focus: Built-in Features to Safeguard Your Applications
PDF
Two Aspect Validation Control Frameworks for Online Distributed Services
PPT
Web 20 Security - Vordel
PDF
Research Inventy : International Journal of Engineering and Science
PDF
Implementing Microservices Security Patterns & Protocols with Spring
PPTX
2.1 Web Vulnerabilities.pptx
SCWCD : Secure web : CHAP : 7
Bluedog white paper - Our WebObjects Web Security Model
Spring Security services for web applications
AbedElilahElmahmoumP1.pptx
Web security
Secure coding presentation Oct 3 2020
IRJET- Privacy Preserving and Proficient Identity Search Techniques for C...
ppt.ppt
Cloud Identity Management
Authentication and Authorization in jaipur
Final PPT after cla after class (1).pptx
Step by step guide for web application security testing
Spring security jwt tutorial toptal
OWASP-top 10 Compliance checklist -.56854.pdf
Security Focus: Built-in Features to Safeguard Your Applications
Two Aspect Validation Control Frameworks for Online Distributed Services
Web 20 Security - Vordel
Research Inventy : International Journal of Engineering and Science
Implementing Microservices Security Patterns & Protocols with Spring
2.1 Web Vulnerabilities.pptx
Ad

More from WebStackAcademy (20)

PDF
Webstack Academy - Course Demo Webinar and Placement Journey
PDF
WSA: Scaling Web Service to Handle Millions of Requests per Second
PDF
WSA: Course Demo Webinar - Full Stack Developer Course
PDF
Career Building in AI - Technologies, Trends and Opportunities
PDF
Webstack Academy - Internship Kick Off
PDF
Building Your Online Portfolio
PDF
Front-End Developer's Career Roadmap
PDF
Angular - Chapter 9 - Authentication and Authorization
PDF
Angular - Chapter 7 - HTTP Services
PDF
Angular - Chapter 6 - Firebase Integration
PDF
Angular - Chapter 5 - Directives
PDF
Angular - Chapter 4 - Data and Event Handling
PDF
Angular - Chapter 3 - Components
PDF
Angular - Chapter 2 - TypeScript Programming
PDF
Angular - Chapter 1 - Introduction
PDF
JavaScript - Chapter 10 - Strings and Arrays
PDF
JavaScript - Chapter 15 - Debugging Techniques
PDF
JavaScript - Chapter 14 - Form Handling
PDF
JavaScript - Chapter 13 - Browser Object Model(BOM)
PDF
JavaScript - Chapter 12 - Document Object Model
Webstack Academy - Course Demo Webinar and Placement Journey
WSA: Scaling Web Service to Handle Millions of Requests per Second
WSA: Course Demo Webinar - Full Stack Developer Course
Career Building in AI - Technologies, Trends and Opportunities
Webstack Academy - Internship Kick Off
Building Your Online Portfolio
Front-End Developer's Career Roadmap
Angular - Chapter 9 - Authentication and Authorization
Angular - Chapter 7 - HTTP Services
Angular - Chapter 6 - Firebase Integration
Angular - Chapter 5 - Directives
Angular - Chapter 4 - Data and Event Handling
Angular - Chapter 3 - Components
Angular - Chapter 2 - TypeScript Programming
Angular - Chapter 1 - Introduction
JavaScript - Chapter 10 - Strings and Arrays
JavaScript - Chapter 15 - Debugging Techniques
JavaScript - Chapter 14 - Form Handling
JavaScript - Chapter 13 - Browser Object Model(BOM)
JavaScript - Chapter 12 - Document Object Model

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Sensors and Actuators in IoT Systems using pdf
PDF
Advanced IT Governance
PPTX
MYSQL Presentation for SQL database connectivity
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Modernizing your data center with Dell and AMD
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
Review of recent advances in non-invasive hemoglobin estimation
Big Data Technologies - Introduction.pptx
cuic standard and advanced reporting.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Reach Out and Touch Someone: Haptics and Empathic Computing
Advanced methodologies resolving dimensionality complications for autism neur...
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Sensors and Actuators in IoT Systems using pdf
Advanced IT Governance
MYSQL Presentation for SQL database connectivity
“AI and Expert System Decision Support & Business Intelligence Systems”
breach-and-attack-simulation-cybersecurity-india-chennai-defenderrabbit-2025....
NewMind AI Weekly Chronicles - August'25 Week I
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Modernizing your data center with Dell and AMD
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Review of recent advances in non-invasive hemoglobin estimation

Web Component Development Using Servlet & JSP Technologies (EE6) - Chapter 12 - Implementing Security

  • 1. Web Component Development with Servlet & JSP Technologies (EE 6) Module-12: Implementing Security
  • 2. Objectives Upon completion of this module, you should be able to: ● Describe a common failure mode in security ● Require that a user log in before accessing specific pages in your web application ● Describe the Java EE security model ● Require SSL encrypted communication for certain URLs or servlets
  • 3. Relevance Discussion – The following question is relevant to understanding what technologies are available for developing web applications and the limitations of those technologies: ● If your application uses data that are private to your company or your users, how can you be sure that malicious users cannot inappropriately access or modify those data?
  • 4. Security Considerations Every application that is accessible over the web must consider security. Your site must be protected from attack, the private data of your site’s users must be kept confidential, and your site must also protect the browsers and computers used to access your site. This module introduces the following kwy points: ● Confusion of code and data ● Encryption of data in transit over the network ● Authentication and authorization of users
  • 5. Confusion of Code and Data: SQL Injection Example Your application might take the text of the item code, provided by the user, and paste it into an SQL statement like this: SELECT count from ITEMTABLE where itemcode=”XXXXXX”; In this case, the XXXXXX would be replaced using the data provided by the user in the field of the form. This looks fine so far, but consider what happens if the user provides the following as the itemCode field in the form: unk”; DROP TABLE ITEMTABLE;
  • 6. Confusion of Code and Data: SQL Injection Example Now the result of pasting this “data” into the query is this: SELECT count from ITEMTABLE where itemcode=”unk”; DROP TABLE ITEMTABLE;”;
  • 7. Authentication and Authorization The application usually needs to be able to identify the user, decide what operations the user is allowed to perform, and maintain the confidentiality and the integrity of the data that is in transit.
  • 10. Authenticating the Caller Caller authentication is the process of verifying what the user’s identity is, and consists of the following two steps. ● Determine the identity claimed by the user ● Verify that the user is who they claim to be (Authenticate the user)
  • 11. Establishing User Identities The process of caller authentication requires that users of an application be known in advance to the security system. The Java EE specification recognizes the following two types of user identities: ● Principals: A principal is an authenticated user in the application security domain. That is, a principal is identifyable to, and can be authenticated by, a JAAS authentication mechanism deployed in the web container. ● Roles: When writing an application, the users, and the principals to which they will map, are usually not known. Nevertheless, you must design a security model that will specify that certain categories of user will have certain rights and be denied other rights.
  • 12. Examining the Java EE Authorization Strategies ● The primary purpose of the Java EE security model is to control access to business services and resources in the application. ● The Java EE security model provides two complementary strategies for access control: ● Programmatic access control and declarative access control. ● Both strategies assume that the user has been authenticated by the application server, and the roles of which the user is a member can therefore be determined by the web container.
  • 13. Using Declarative Authorization Declarative authorization for web applications involves the following Tasks: ● Collection of user credentials into a credentials database ● Declaration of roles ● Mapping users to roles ● Specification of role requirements for access to URLs
  • 14. Creating a Credential Database Creating the collection of user credential is entirely dependent on the web containerin use. The lab for tis module will show you the most basic way to achieve this in Netbeans/ Glassfish you are using.
  • 15. Declaring Security Roles Security roles are declared in the web.xml deployment descriptor, using the <security-role> element. This element lives at the first level of the web.xml file, as a direct child of the <web-app> element. <security-role> <description>...</description> <role-name>...</role-name> </security-role>
  • 17. Using Programmatic Authorization Programmatic authorization is the responsibility of the bean developer. The following methods in the HttpServletRequest support programmatic authorization: ● boolean isUserInRole(String role) ● Principal getUserPrincipal() ● Programmatic authorization is more expressive than the declarative approach, but is more cumbersome to maintain, and because of the additional complexity, more error prone.
  • 18. Enforcing Encrypted Transport Provided the server has been configured with a public key certificate, you can require that communication between client and server be encrypted. In this case, an additional element, <user-data-constraint> will be added in the web.xml file
  • 19. Web Stack Academy (P) Ltd #83, Farah Towers, 1st floor,MG Road, Bangalore – 560001 M: +91-80-4128 9576 T: +91-98862 69112 E: [email protected] www.webstackacademy.com