Java Application Security Frameworks
If you're creating a web app, security is more important than ever. Learn about some great Java-based frameworks that add extra security to your apps.
Join the DZone community and get the full member experience.Join For Free
When developing an application, security is a major concern. Any piece of code or application running over a network is vulnerable to risks and can threaten privacy, security, and integrity issues.
According to Open Web Application Security Project (OWASP), the most critical security risks are:
- SQL Injection.
- Broken authentication and session management.
- Cross-Site Scripting (XSS).
- Insecure Direct Object References.
- Security Misconfiguration.
- Sensitive Data Exposure.
- Missing Function Level Access Control.
- Cross-Site Request Forgery (CSRF).
- Using Components with Known Vulnerabilities.
- Unvalidated Redirects and Forwards.
Visit OWASP Top Ten Cheat Sheet to learn more about these vulnerabilities.
There are several security frameworks designed to make the process of securing an application faster, easier, and many times more successful. Some of them are:
JAAS (Java Authentication and Authorization Services)
JAAS is a security API which consists of a set of Java packages designed for user authentication and authorization. It was introduced as an optional package in Java SE 1.3 and later integrated into the JDK starting with JDK 1.4.
JAAS authentication is performed in a pluggable fashion. This permits the application to remain independent from the underlying authentication technologies.
Check the reference guide for the API and examples.
Spring Security is a highly customizable framework that is widely used to tackle authentication and access control (authorization) issues in Enterprise based applications built on Java.
Authentication is the process of establishing that a principal is who they claim to be (can be a user, device, or some other system which can perform an action in your application). Authorization is a process of deciding whether a principal can perform an action within your application.
I’ve used this framework; it is easy to learn and integrate. Check out the reference guide for more details.
Apache Shiro is considered a highly powerful security framework for Java that performs cryptography, authorization, and session management on all types of Java applications, regardless of their size.
Shiro has been designed to be an intuitive and easy-to-use framework while still providing robust security features. It is framework independent and hence can seamlessly work on any Java supported frameworks.
Refer their website for detailed documentation.
HDIV is a Java Web Application Security Framework. It extends web applications’ behavior by adding Security functionalities and maintaining the API and the framework specification.
It is widely used for applications built on Struts, Spring MVC, Grails, JSTL, etc. since it offers developers much-needed transparency without adding any complexities in the development of applications.
Check out their documentation for more details.
OACC is an application security framework for Java designed for fine grained (object level) access control. It focuses on providing a fully featured API to both enforce and manage an application’s authentication and authorization needs – it is a full implementation of a powerful and flexible security model.
OACC uses the abstraction of a resource for the application objects being secured. This key abstraction enables OACC to provide a rich API that includes grant, revoke, and query capabilities for storing and managing the application’s security relationships.
Learn more about OACC here.
All these frameworks protect the applications by offering the required security in terms of authentication, authorization, data validation, session management, encryption, etc. Choose any of these frameworks depending on the privacy, security, and integrity required in your application.
Have you tried any other framework that is not listed here? Let me know in the comments!
Published at DZone with permission of Swathi Prasad, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.