J2EE Security: JAAS or declarative J2EE security ?

2024-04-13 14:18
文章标签 security j2ee declarative jaas

本文主要是介绍J2EE Security: JAAS or declarative J2EE security ?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

J2EE Security: JAAS or declarative J2EE security ?

Is there a need for a JAAS framework for Web application security?

With the Java Authentication and Authorization Service (JAAS), recently added as an official component to the J2EE platform, and the standard declarative J2EE security model, implemented in the J2EE containers, it seems that there exist two tools that obviously do the same thing. It therefore doesn’t come by surprise that application developers seem to be trapped by which options to choose when building Web applications.

Declarative J2EE security is role based, which means that user populations are authorized based on their group memberships. Declarative J2EE security is code independent and doesn’t need to be known by the developer when creating the application. For complex access evaluations, declarative security can be checked programmatically in calls to isUserInRole() or isCallerInRole(). The role name used in an application code can later be mapped to an existing security role name in the web.xml file, using the element. This clearly separates application code from the security definitions.

JAAS is the technology of the moment with a lot of buzzin’ around it. Compared to declarative security, the JAAS implementation doesn’t allow the decoupling of application code and security code to the same extend. However, JAAS is finer grained in that it can protect individual code sources based on the user (Subject) running it, and also seems to be more powerful.

In JAAS, a user is granted a set of Permissions that are evaluated by a call to checkPermission() when the application code is executed.

Historically, JAAS was designed for the Java 2 Standard Edition (J2SE) where it still is located in, but made its way to the J2EE web stack.

The Web, also historically, is using the declarative J2EE security, which is much better integrated in J2EE containers than JAAS. Web technologies like Apache Struts by default support the declarative J2EE security in the framework and its Tag Libraries.

Sitting here and preparing for my presentations and demo ground duties at this year’s OOW in Sao Paulo, I thought of doing a quick search on what’s available for protecting Web applications with JAAS and how JAAS is used in Web applications.

Two open source frameworks, beside of vendor specifiv implementations like on Oracle Application Server and BEA Weblogic, are what I could find: jGuard and Gabriel.

The approaches of Gabriel is aspect oriented and similar to what’s described in chapter 10 “Authentication and Authorization” of the book “AspectJ in Action” by Ramnivas Laddad. jGuard is interesting in that it handles security permissions in the database, which sound like a good idea for Oracle customers that historically used the database for all kind of application configuration and that don’t want to use Oracle Internet Directory as a central repository for end-to-end security.
From a first glance, Gabriel missed the concept of roles and groups, which greatly helps to simplify security administration. Using roles, the actual JAAS permission is granted to the role Principal, which then is applied to the authenticated Subject.

One of the reasons why you want to use a framework for authentication and authorization – if using JAAS – is for consistency because security has to be the same on all layers – view, controller and model – involved in creating and running J2EE applications.

Next search was for Java ServerFaces (JSF), just being curious for what the expert group has decided to use in their default implementation. Again, not a surprise, JSF relies on declarative J2EE security and not JAAS. I understand this decision because JSF ships as a view layer technology and isn’t supposed to provide a general security framework for JAAS.

The conclusion of my investigation is that JAAS shows okay and greatly adopted as a technology, but still lacks an agreed standard framework for securing Web applications including the controller and model portion.

Something Apache Struts like for JAAS security would be good to have. Preferably, having a JSR for it could ensure that the implementation of JAAS security for web applications is neither vendor nor implementation specific.

Based on this work, tag libraries would be developed that enable JSF applications to leverage JAAS for security. JSR-196 expose JAAS security so that it can be used with declarative J2EE security, but this doesn’t seem to be enough.

For those that work with Apache Struts today, its not a big deal to change the Request Processor object to evaluate JAAS permissions instead of processing J2EE roles, but this still doesn’t solve the problem of the lack of a standard security framework for J2EE applications.

I am sure we will see future improvements around this topic.

Frank

Posted by Frank.Nimphius at October 25, 2004 04:24 PM

这篇关于J2EE Security: JAAS or declarative J2EE security ?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/900370

相关文章

Spring Security 基于表达式的权限控制

前言 spring security 3.0已经可以使用spring el表达式来控制授权,允许在表达式中使用复杂的布尔逻辑来控制访问的权限。 常见的表达式 Spring Security可用表达式对象的基类是SecurityExpressionRoot。 表达式描述hasRole([role])用户拥有制定的角色时返回true (Spring security默认会带有ROLE_前缀),去

Security OAuth2 单点登录流程

单点登录(英语:Single sign-on,缩写为 SSO),又译为单一签入,一种对于许多相互关连,但是又是各自独立的软件系统,提供访问控制的属性。当拥有这项属性时,当用户登录时,就可以获取所有系统的访问权限,不用对每个单一系统都逐一登录。这项功能通常是以轻型目录访问协议(LDAP)来实现,在服务器上会将用户信息存储到LDAP数据库中。相同的,单一注销(single sign-off)就是指

浅析Spring Security认证过程

类图 为了方便理解Spring Security认证流程,特意画了如下的类图,包含相关的核心认证类 概述 核心验证器 AuthenticationManager 该对象提供了认证方法的入口,接收一个Authentiaton对象作为参数; public interface AuthenticationManager {Authentication authenticate(Authenti

Spring Security--Architecture Overview

1 核心组件 这一节主要介绍一些在Spring Security中常见且核心的Java类,它们之间的依赖,构建起了整个框架。想要理解整个架构,最起码得对这些类眼熟。 1.1 SecurityContextHolder SecurityContextHolder用于存储安全上下文(security context)的信息。当前操作的用户是谁,该用户是否已经被认证,他拥有哪些角色权限…这些都被保

Spring Security基于数据库验证流程详解

Spring Security 校验流程图 相关解释说明(认真看哦) AbstractAuthenticationProcessingFilter 抽象类 /*** 调用 #requiresAuthentication(HttpServletRequest, HttpServletResponse) 决定是否需要进行验证操作。* 如果需要验证,则会调用 #attemptAuthentica

Spring Security 从入门到进阶系列教程

Spring Security 入门系列 《保护 Web 应用的安全》 《Spring-Security-入门(一):登录与退出》 《Spring-Security-入门(二):基于数据库验证》 《Spring-Security-入门(三):密码加密》 《Spring-Security-入门(四):自定义-Filter》 《Spring-Security-入门(五):在 Sprin

j2EE通用jar包的作用

原文:http://blog.sina.com.cn/s/blog_610901710101kx37.html IKIKAnalyzer3.2.8.jar // 分词器 ant-junit4.jar // ant junit antlr-2.7.6.jar // 没有此包,hibernate不会执行hql语句。并且会报NoClassDefFoundError: antlr

spring security 中的授权使用

一、认证     身份认证,就是判断一个用户是否为合法用户的处理过程。Spring Security 中支持多种不同方式的认证,但是无论开发者使用那种方式认证,都不会影响授权功能使用。因为 SpringSecurity 很好做到了认证和授权解耦。   二、授权     授权,即访问控制,控制谁能访问哪些资源。简单的理解授权就是根据系统提前设置好的规则,给用户分配可以访问某一个资源的

spring security 中的异常

一、简介 Spring Security 中异常主要分为两大类: 1、AuthenticationException: 认证异常 2、AccessDeniedException:  授权异常 AuthenticationEntryPoint 该类用来统一处理  AuthenticationException 异常 AccessDeniedHandler 该类用来统一处理  AccessDe

活动预告|“AI+Security”系列第3期:AI安全智能体,重塑安全团队工作范式

由安全极客、Wisemodel社区、InForSec网络安全研究国际学术论坛和海升集团联合主办的 “AI+Security”系列第3期: AI 安全智能体,重塑安全团队工作范式  线下活动 将于2024年9月11日下午14:00 在中关村智造大街G座路演厅 正式举行 欢迎扫描海报中二维码报名参与 【会议议程】