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

What's hot (18)

PPTX
Secure Code Warrior - Least privilege
Secure Code Warrior
 
PPT
Web security 2010
Alok Babu
 
PPTX
Secure Code Warrior - Trust no input
Secure Code Warrior
 
PPT
Mule security - authorization using spring security
D.Rajesh Kumar
 
PDF
Design and Configuration of App Supportive Indirect Internet Access using a ...
IJMER
 
PPTX
Web authentication & authorization
Alexandru Pasaila
 
PPTX
Sql security
SaHil Chaturvedi
 
PDF
Database security issues
n|u - The Open Security Community
 
PDF
IRJET - SQL Injection: Attack & Mitigation
IRJET Journal
 
PDF
Web Programming - 12 Authentication and Authorization
AndiNurkholis1
 
PPTX
Owasp web security
Pankaj Kumar Sharma
 
PPTX
Box Authentication Types
Jonathan LeBlanc
 
DOC
Joomla web application development vulnerabilities
BlazeDream Technologies Pvt Ltd
 
PPTX
Code injection
Gayatri Patel
 
PPTX
Silverlight in Action
DotNetMarche
 
PPT
Mule security-jaas
Praneethchampion
 
PPTX
Sql injections (Basic bypass authentication)
Ravindra Singh Rathore
 
PDF
Broken access control
Priyanshu Gandhi
 
Secure Code Warrior - Least privilege
Secure Code Warrior
 
Web security 2010
Alok Babu
 
Secure Code Warrior - Trust no input
Secure Code Warrior
 
Mule security - authorization using spring security
D.Rajesh Kumar
 
Design and Configuration of App Supportive Indirect Internet Access using a ...
IJMER
 
Web authentication & authorization
Alexandru Pasaila
 
Sql security
SaHil Chaturvedi
 
Database security issues
n|u - The Open Security Community
 
IRJET - SQL Injection: Attack & Mitigation
IRJET Journal
 
Web Programming - 12 Authentication and Authorization
AndiNurkholis1
 
Owasp web security
Pankaj Kumar Sharma
 
Box Authentication Types
Jonathan LeBlanc
 
Joomla web application development vulnerabilities
BlazeDream Technologies Pvt Ltd
 
Code injection
Gayatri Patel
 
Silverlight in Action
DotNetMarche
 
Mule security-jaas
Praneethchampion
 
Sql injections (Basic bypass authentication)
Ravindra Singh Rathore
 
Broken access control
Priyanshu Gandhi
 

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

PPTX
SCWCD : Secure web : CHAP : 7
Ben Abdallah Helmi
 
PDF
Bluedog white paper - Our WebObjects Web Security Model
tom termini
 
PPTX
Spring Security services for web applications
StephenKoc1
 
PPTX
AbedElilahElmahmoumP1.pptx
AbedElElahElMHMOOM
 
PPTX
Web security
Padam Banthia
 
PDF
Secure coding presentation Oct 3 2020
Moataz Kamel
 
PDF
IRJET- Privacy Preserving and Proficient Identity Search Techniques for C...
IRJET Journal
 
PPT
ppt.ppt
pbrinda
 
PPTX
Cloud Identity Management
Damian T. Gordon
 
PPTX
Authentication and Authorization in jaipur
tech23250
 
PPTX
Final PPT after cla after class (1).pptx
nandan543979
 
PPT
Step by step guide for web application security testing
Avyaan, Web Security Company in India
 
PDF
Spring security jwt tutorial toptal
jbsysatm
 
PDF
OWASP-top 10 Compliance checklist -.56854.pdf
prashantbamane7
 
DOCX
Security Focus: Built-in Features to Safeguard Your Applications
akankshawande
 
PDF
Two Aspect Validation Control Frameworks for Online Distributed Services
IRJET Journal
 
PPT
Web 20 Security - Vordel
guest2a1135
 
PDF
Research Inventy : International Journal of Engineering and Science
researchinventy
 
PDF
Implementing Microservices Security Patterns & Protocols with Spring
VMware Tanzu
 
PPTX
2.1 Web Vulnerabilities.pptx
MiteshVyas16
 
SCWCD : Secure web : CHAP : 7
Ben Abdallah Helmi
 
Bluedog white paper - Our WebObjects Web Security Model
tom termini
 
Spring Security services for web applications
StephenKoc1
 
AbedElilahElmahmoumP1.pptx
AbedElElahElMHMOOM
 
Web security
Padam Banthia
 
Secure coding presentation Oct 3 2020
Moataz Kamel
 
IRJET- Privacy Preserving and Proficient Identity Search Techniques for C...
IRJET Journal
 
ppt.ppt
pbrinda
 
Cloud Identity Management
Damian T. Gordon
 
Authentication and Authorization in jaipur
tech23250
 
Final PPT after cla after class (1).pptx
nandan543979
 
Step by step guide for web application security testing
Avyaan, Web Security Company in India
 
Spring security jwt tutorial toptal
jbsysatm
 
OWASP-top 10 Compliance checklist -.56854.pdf
prashantbamane7
 
Security Focus: Built-in Features to Safeguard Your Applications
akankshawande
 
Two Aspect Validation Control Frameworks for Online Distributed Services
IRJET Journal
 
Web 20 Security - Vordel
guest2a1135
 
Research Inventy : International Journal of Engineering and Science
researchinventy
 
Implementing Microservices Security Patterns & Protocols with Spring
VMware Tanzu
 
2.1 Web Vulnerabilities.pptx
MiteshVyas16
 
Ad

More from WebStackAcademy (20)

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

Recently uploaded (20)

PDF
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
PPTX
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
PDF
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
PDF
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PDF
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
DOCX
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
PDF
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
PPTX
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
PPTX
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
PPTX
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
PDF
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 
Future-Proof or Fall Behind? 10 Tech Trends You Can’t Afford to Ignore in 2025
DIGITALCONFEX
 
COMPARISON OF RASTER ANALYSIS TOOLS OF QGIS AND ARCGIS
Sharanya Sarkar
 
UPDF - AI PDF Editor & Converter Key Features
DealFuel
 
Bitcoin for Millennials podcast with Bram, Power Laws of Bitcoin
Stephen Perrenod
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Automating Feature Enrichment and Station Creation in Natural Gas Utility Net...
Safe Software
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
UiPath DevConnect 2025: Agentic Automation Community User Group Meeting
DianaGray10
 
Python coding for beginners !! Start now!#
Rajni Bhardwaj Grover
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
What’s my job again? Slides from Mark Simos talk at 2025 Tampa BSides
Mark Simos
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
Newgen Beyond Frankenstein_Build vs Buy_Digital_version.pdf
darshakparmar
 
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Alexandra N. Martinez
 
NASA A Researcher’s Guide to International Space Station : Physical Sciences ...
Dr. PANKAJ DHUSSA
 
Designing_the_Future_AI_Driven_Product_Experiences_Across_Devices.pptx
presentifyai
 
Agentforce World Tour Toronto '25 - MCP with MuleSoft
Alexandra N. Martinez
 
Seamless Tech Experiences Showcasing Cross-Platform App Design.pptx
presentifyai
 
🚀 Let’s Build Our First Slack Workflow! 🔧.pdf
SanjeetMishra29
 

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