SlideShare a Scribd company logo
Java Security Java Authentication & Session Management
Provided Java Security Java itself A number of providers provided to implement a core set of security features Cryptography packages  Secure peer to peer communication protocols Allows custom and 3 rd  party providers
Java Authentication The process of determining the identity of a user Used to restrict access to resources The API’s enable “Pluggable” modules for login  Enabling the independence from the underlying plug-in modules
Java Authentication Provided login modules located in the  javax.security.suth.spi.LoginModule interface   Krb5Loginmodule used for Kerberos protocols   JndiLoginModule for username/password authentication using LDAP or NIS database KeyStoreLoginModule for any type of KeyStore, including PKCS#11
Java Authentication Enforces two separate approaches  Declarative Programmatic
Java Authentication Declarative Restricts access to URL’s Restricts access to Servlets Restricts access to EJB’s Automatic redirect to the login page when authentication is requested
Java Authentication Programmatic Provides querying and calling mechanisms Developer is responsible to enforce security constraints
Java Authentication JAAS Java Authentication and Authorization Service   Uses PAM Pluggable Authentication Module
Java Authentication initialize() public static void main(String args[]) { LoginContext lc = new LoginContext("Login", new MyCallbackHandler(args[0],args[1])); }   login() Callback[] calls=new Callback[2]; calls[0]=new NameCallback("name"); calls[1]=new PasswordCallback("Password",false); callbackHandler.handle(calls);
Java Authentication commit() f(verification) {subject.getPrincipals().add(userName); …subject.getPrincipals().add(role); return true; }else return false;   logout() subject.getPrincipals().clear(); verification=false; return true;
Java Session Management Provides state management across user requests Sessions are used to store user information Sessions are used for application security Sessions are used to time out a session
Java Session Management Done with four  techniques   Cookies URLRewriting Hidden Forms Session Objects
Java Session Management Cookies A cookie is a piece of information Sent with every request or response Sends name/value pairs Formatted:  Cookie ci = new Cookie(“myCookie”,”secret”);
Java Session Management URLRewriting Place a token or identifier at the end of the URL Send name/value pairs Format: url?name1=value1&name2=value2&….  Uses the methods: encodeURL() and encodeRedirectURL()
Java Session Management Hidden Fields Very much like URLRewriting  The value cannot be seen in the URL Value can be seen in the HTML source Hidden Field require the use of a form
Java Session Management Session Objects Provided by the javax.servlet.http.HttpSession interface Used to store objects Linked Information to a user Get user information with getSession()

More Related Content

What's hot (20)

PDF
Peeples authentication authorization_services_with_saml_xacml_with_jboss_eap6
Kenneth Peeples
 
PPTX
Identity management and single sign on - how much flexibility
Ryan Dawson
 
PPTX
ApacheCon 2014: Infinite Session Clustering with Apache Shiro & Cassandra
DataStax Academy
 
PDF
Authentication in microservice systems - fsto 2017
Dejan Glozic
 
PPTX
Draft: building secure applications with keycloak (oidc/jwt)
Abhishek Koserwal
 
PPTX
Java EE 8 security and JSON binding API
Alex Theedom
 
PPTX
JWT SSO Inbound Authenticator
MifrazMurthaja
 
PPTX
Integrating Security Roles into Microsoft Silverlight Applications
Dan Wahlin
 
PDF
Super simple application security with Apache Shiro
Marakana Inc.
 
PPTX
Help! I Have An Identity Crisis: A look at various mechanisms of Single Sign On
Saloni Shah
 
PDF
DEF CON 27 - ALVARO MUNOZ / OLEKSANDR MIROSH - sso wars the token menace
Felipe Prado
 
PPTX
Jasig Cas High Availability - Yale University
Jasig CAS
 
PDF
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Hermann Burgmeier
 
PDF
Configuring kerberos based sso in weblogic
Harihara sarma
 
PDF
Case Study Design Pattern - Object Adapter
Adrian Seungjin Lee
 
PDF
Foreman Single Sign-On Made Easy with Keycloak
Nikhil Kathole
 
PPTX
How to Install and Configure your own Identity Manager GE
Federico Fernández Moreno
 
PDF
Protecting web APIs with OAuth 2.0
Vladimir Dzhuvinov
 
PPTX
REST Easy with Deployd - tiConf EU 2013
Boydlee Pollentine
 
PPTX
Deep Dive into Keystone Tokens and Lessons Learned
Priti Desai
 
Peeples authentication authorization_services_with_saml_xacml_with_jboss_eap6
Kenneth Peeples
 
Identity management and single sign on - how much flexibility
Ryan Dawson
 
ApacheCon 2014: Infinite Session Clustering with Apache Shiro & Cassandra
DataStax Academy
 
Authentication in microservice systems - fsto 2017
Dejan Glozic
 
Draft: building secure applications with keycloak (oidc/jwt)
Abhishek Koserwal
 
Java EE 8 security and JSON binding API
Alex Theedom
 
JWT SSO Inbound Authenticator
MifrazMurthaja
 
Integrating Security Roles into Microsoft Silverlight Applications
Dan Wahlin
 
Super simple application security with Apache Shiro
Marakana Inc.
 
Help! I Have An Identity Crisis: A look at various mechanisms of Single Sign On
Saloni Shah
 
DEF CON 27 - ALVARO MUNOZ / OLEKSANDR MIROSH - sso wars the token menace
Felipe Prado
 
Jasig Cas High Availability - Yale University
Jasig CAS
 
Mixing OAuth 2.0, Jersey and Guice to Build an Ecosystem of Apps - JavaOne...
Hermann Burgmeier
 
Configuring kerberos based sso in weblogic
Harihara sarma
 
Case Study Design Pattern - Object Adapter
Adrian Seungjin Lee
 
Foreman Single Sign-On Made Easy with Keycloak
Nikhil Kathole
 
How to Install and Configure your own Identity Manager GE
Federico Fernández Moreno
 
Protecting web APIs with OAuth 2.0
Vladimir Dzhuvinov
 
REST Easy with Deployd - tiConf EU 2013
Boydlee Pollentine
 
Deep Dive into Keystone Tokens and Lessons Learned
Priti Desai
 

Recently uploaded (20)

PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PPTX
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
PDF
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
PPTX
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PDF
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PDF
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
PDF
Python Conference Singapore - 19 Jun 2025
ninefyi
 
PDF
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
PDF
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PPTX
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
PPTX
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
Why aren't you using FME Flow's CPU Time?
Safe Software
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Paycifi - Programmable Trust_Breakfast_PPTXT
FinTech Belgium
 
Java 25 and Beyond - A Roadmap of Innovations
Ana-Maria Mihalceanu
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
UiPath Agentic AI ile Akıllı Otomasyonun Yeni Çağı
UiPathCommunity
 
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
How to Visualize the ​Spatio-Temporal Data Using CesiumJS​
SANGHEE SHIN
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
LLM Search Readiness Audit - Dentsu x SEO Square - June 2025.pdf
Nick Samuel
 
Python Conference Singapore - 19 Jun 2025
ninefyi
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
Salesforce Summer '25 Release Frenchgathering.pptx.pdf
yosra Saidani
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
01_Approach Cyber- DORA Incident Management.pptx
FinTech Belgium
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Why aren't you using FME Flow's CPU Time?
Safe Software
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Ad

Java Security And Authentacation

  • 1. Java Security Java Authentication & Session Management
  • 2. Provided Java Security Java itself A number of providers provided to implement a core set of security features Cryptography packages Secure peer to peer communication protocols Allows custom and 3 rd party providers
  • 3. Java Authentication The process of determining the identity of a user Used to restrict access to resources The API’s enable “Pluggable” modules for login Enabling the independence from the underlying plug-in modules
  • 4. Java Authentication Provided login modules located in the javax.security.suth.spi.LoginModule interface Krb5Loginmodule used for Kerberos protocols JndiLoginModule for username/password authentication using LDAP or NIS database KeyStoreLoginModule for any type of KeyStore, including PKCS#11
  • 5. Java Authentication Enforces two separate approaches Declarative Programmatic
  • 6. Java Authentication Declarative Restricts access to URL’s Restricts access to Servlets Restricts access to EJB’s Automatic redirect to the login page when authentication is requested
  • 7. Java Authentication Programmatic Provides querying and calling mechanisms Developer is responsible to enforce security constraints
  • 8. Java Authentication JAAS Java Authentication and Authorization Service Uses PAM Pluggable Authentication Module
  • 9. Java Authentication initialize() public static void main(String args[]) { LoginContext lc = new LoginContext("Login", new MyCallbackHandler(args[0],args[1])); } login() Callback[] calls=new Callback[2]; calls[0]=new NameCallback("name"); calls[1]=new PasswordCallback("Password",false); callbackHandler.handle(calls);
  • 10. Java Authentication commit() f(verification) {subject.getPrincipals().add(userName); …subject.getPrincipals().add(role); return true; }else return false; logout() subject.getPrincipals().clear(); verification=false; return true;
  • 11. Java Session Management Provides state management across user requests Sessions are used to store user information Sessions are used for application security Sessions are used to time out a session
  • 12. Java Session Management Done with four techniques Cookies URLRewriting Hidden Forms Session Objects
  • 13. Java Session Management Cookies A cookie is a piece of information Sent with every request or response Sends name/value pairs Formatted: Cookie ci = new Cookie(“myCookie”,”secret”);
  • 14. Java Session Management URLRewriting Place a token or identifier at the end of the URL Send name/value pairs Format: url?name1=value1&name2=value2&…. Uses the methods: encodeURL() and encodeRedirectURL()
  • 15. Java Session Management Hidden Fields Very much like URLRewriting The value cannot be seen in the URL Value can be seen in the HTML source Hidden Field require the use of a form
  • 16. Java Session Management Session Objects Provided by the javax.servlet.http.HttpSession interface Used to store objects Linked Information to a user Get user information with getSession()