When developing an application, security is a major concern. Any piece of code or application running over 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 application to remain independent from underlying authentication technologies.
Check the reference guide for API and examples.
Spring Security is a highly customizable framework that is widely used to tackle with authentication and access control (authorization) issues in Enterprise based applications built on Java.
Authentication is the process of establishing 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 as a highly powerful security framework of Java that performs cryptography, authorization and session management of 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, 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 the much-needed transparency without adding any complexities in application development.
Checkout 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!