- 浏览: 240157 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
akka_li:
学习了!但是为什么后续的没有了?!
EJB4:RMI和RMI-IIOP -
springaop_springmvc:
apache lucene开源框架demo使用实例教程源代码下 ...
Lucene学习笔记(一)Lucene入门实例 -
qepipnu:
求solr 客户端 jar包
Solr学习笔记(三)Solr客户端开发实例 -
zhangbc:
是这问题,赞!
Oracle Start Up 2 Oracle 框架构件、启动、解决一个问题 -
feilian09:
查询 select hibernate jdbc 那个效率快
Hibernate,JDBC性能探讨
Jboss has a series of implementation of InitialContext Factory, but this blog only concentrated on org.jboss.security.jndi.LoginInitialContextFactory, and I was planned to prestent this issue as Two main part, Part One: Theroy-based(including some definition of LoginInitialContextFactory, InitialContext Properties description), and Part Two: Demo-based(Complete a simple demo which use LoginInitialContextFactory).
PART ONE: The Login InitialContext Factory Implementation
1. why LoginInitialContextFactory?
JAAS is the preferred method for authenticating a remote client to JBoss. However, for simplicity and to ease the migration from other application server environment that does not use JAAS, JBoss allows you the security credentials to be passed through the InitialContext, so the LoginInitialContextFactory came out.
2. Originally or Old version JBoss DO NOT support LoginInitialContextFactory.
Historically JBoss has not supported providing login information via the InitialContext factory environment. The reason being that is JAAS provides a much more flexible framework. For simplicity and migration from other application server environment that do make use of this mechanism, since jboss-3.0.3 there has been an InitialContext factory implementation that allow this.
3. How the LoginInitialContextFactory work(authenticating clients through JAAS)?
Authough this kinds of authentication is thought as J2EE JAAS, but there is no manifest use of the JAAS interface in the client application, Only be taken placed in Server which we can say what JAASis used under the covers.
What this basically does is that when the client is trying to download the naming proxy on the client side, JAAS login is performed with the login configuration name to be equal to the name passed in Context.SECURITY_PROTOCOL, username and credential from the context information. Only after the login succeeds, will the naming proxy be returned.
4. InitialContext environment properties for LoginInitialContextFactory
The factory class that provides this capability is the org.jboss.security.jndi.LoginInitialContextFactory. The complete set of supported InitialContext environment properties for this factory as the below Table:
java.naming.factory.initial (Context.INITIAL_CONTEXT_FACTORY ) java.naming.provider.url (java.naming.provider.url ) java.naming.security.principal (Context.SECURITY_PRINCIPAL ) java.naming.security.credentials (Context.SECURITY_CREDENTIALS ) java.naming.security.protocol (Context.SECURITY_PROTOCOL)
Name
Description
Value
The name of the environment property for specifying the initial context factory,
org.jboss.security.jndi.LoginInitialContextFactory
The principal to authenticate
This may be either a java.security.Principal implementation or a string representing the name of a principal.
The credentials that should be used to authenticate the principal
java.naming.factory.url.pkgs
For all JBoss JNDI provider this must be
org.jboss.naming:org.jnp.interfaces
This gives the name of the
JAAS login module to use for the authentication of the principal and credentials.
Sample Java Code for this properties:
Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.security.jndi.LoginInitialContextFactory"); env.put(Context.PROVIDER_URL, "jnp://192.168.68.83"); env.put(Context.SECURITY_PRINCIPAL, "principal "); env.put(Context.SECURITY_CREDENTIALS, "credentials "); new InitialContext(env);
PART TWO: a simple Demo to use The Login InitialContext Factory Implementation
1. deploy a ejb on JBoss, the session bean class and remote interfaces as following:
public interface TestService { public abstract String ping(); public abstract String getDate(); }
public interface TestServiceLocal extends TestService { }
@Stateless @Remote(TestService.class) @Local(TestServiceLocal.class) @TransactionManagement(TransactionManagementType.CONTAINER) @TransactionAttribute(TransactionAttributeType.REQUIRED) @PermitAll public class LoginInitialContextFactoryTestSession implements TestServiceLocal{ public String ping() { return "Ping LoginInitialContextFactoryTestSession suceessful..."; } public String getDate() { return "[" + new SimpleDateFormat("yyyy-MM-dd'T'kk:mm:ss").format(new Date()) + "]"; } }
as depicted: LoginInitialContextFactoryTestSession is a stateless seeion bean, it own a remote interface and local interface, also need transaction attribute and security setting. when we complete the deploy we can use LoginInitialContextFactory as factoty and pass the princial and credencials what to execute JAAS authentication and authrization, as fllowing code:
File authFile = new File("D:/dev-tools/jboss-eap-4.3/jboss-as/client/auth.conf"); System.setProperty("java.security.auth.login.config", "file:///" + authFile.getAbsolutePath()); Properties properties = new Properties(); properties.setProperty(Context.INITIAL_CONTEXT_FACTORY , "org.jboss.security.jndi.LoginInitialContextFactory"); properties.setProperty(Context.PROVIDER_URL, "jnp://192.168.68.83:1099"); properties.setProperty(Context.SECURITY_PRINCIPAL, "homeTest"); properties.setProperty(Context.SECURITY_CREDENTIALS, "kylin"); Context ctx = new InitialContext(properties); TestService stub = (TestService) ctx.lookup("home-test-v2/LoginInitialContextFactoryTestSession/remote"); System.out.println(stub); System.out.println(stub.ping()); System.out.println(stub.getDate());
run the method the output stream will print:
jboss.j2ee:ear=home-test-v2.ear,jar=LoginInitialContextFactoryTestSession.jar,name=LoginInitialContextFactoryTestSession,service=EJB3 Ping LoginInitialContextFactoryTestSession suceessful... [2011-05-19T16:28:36]
ENDING...
发表评论
-
Oracle - Add Exist Validation Before Create Table
2011-11-07 13:49 1457Usually we need to check the ta ... -
JMX Architecture & "Hello Word" the JMX way
2011-10-25 20:07 1814JMX Architecture Overview: JMX ... -
Jboss-eap-5.1 Messaging
2011-08-02 21:50 2473This section I will concertate ... -
Jboss-eap-5.1 starting up note
2011-07-26 22:46 2585Jboss enterprise platform 5 hav ... -
EJB Security & JAAS Demo
2011-05-21 19:39 1615PROLOGUE: When deploying ... -
Jboss Reference Exception Gallery
2011-04-27 14:08 28921. Unable to locate a login con ... -
Hibernate Annotation 的一个问题,给点意见
2011-03-10 12:43 22问题:org.hibernate.annotations. ... -
大家说说BBC的网站用的是什么技术做的
2011-02-22 05:01 1438最近在英国出差,发现这里的一些网站做的相当有特色,有些网站不是 ... -
Hibernate OneToMany 单向和双向配置对数据存取性能的比较
2011-02-08 17:06 23201. 开篇说明:今天是春 ... -
对Hibernate属性(CascadeType、JoinColumn、JoinTable、ForeignKey等)的研究
2010-12-26 15:45 16675本文列出几个“EJB 学习阶段总结:JBoss下发布一个Toy ... -
EJB 学习阶段总结:JBoss下发布一个Toy企业应用
2010-12-25 12:11 2634解释题目:为什 ... -
EJB7: Message Driven Bean
2010-12-21 22:42 2149在企业系统中需要使用 ... -
EJB6: EntityBean例子
2010-11-26 14:48 1493本例子描述向EJB容器(JBoss)部署http: ... -
JPA dev: 几个问题总结(续)
2010-11-25 18:02 24732. 如何由PoJo类生成数据库中的表 首先可以根据实体间关 ... -
JPA dev: 几个问题总结
2010-11-25 16:56 3404最近工作中遇到几个与JPA相关的问题,本文通过一个例子总结一下 ... -
JAXB学习
2010-11-24 22:35 01 什么是JAXB? JAXB全称Java Ar ... -
EJB5: JPA扩展-J2SE环境下使用EntityManager
2010-11-10 19:07 2708好久没有写博客了,最近比较忙,今天抽时间写点,最近 ... -
EJB4:RMI和RMI-IIOP
2010-11-02 21:14 4135计划提纲:引入→RMI概念→RMI HelloWorld程序→ ... -
EJB3: JBOSS 企业版、JBOSS服务器构架、EJB2.0 HelloWrold实例
2010-10-26 22:43 6473本文的研究基于jboss-eap- ... -
jboss-eap-4.3 启动停止在Configuring from URL: resource:jboss-log4j.xml 问题
2010-10-25 14:49 4053如题,我改用jboss-eap-4.3, 启动时停止在Conf ...
相关推荐
Jboss 项目部署文档 Jboss 项目部署文档是指在 Jboss 服务器上部署项目的详细步骤,包括环境变量的配置、项目打包、配置文件的修改、JNDI 的配置等。以下是 Jboss 项目部署文档的详细知识点: 一、环境变量配置 ...
【JBOSS,JBoss安装部署】 JBoss是Red Hat公司开发的一款开源的应用服务器,它基于Java EE(Enterprise Edition)规范,提供了全面的企业级应用程序部署和管理解决方案。本篇文章将详细讲解JBoss的安装和部署过程,...
【JBoss 应用服务器详解】 JBoss 是一个开源的、基于 J2EE(Java 2 Platform, Enterprise Edition)的应用服务器,由全球开发者社区共同维护和开发。它最初以 LGPL 许可协议发布,允许商业应用免费使用。2006年,...
JBoss AS 7.1.0.Final是在Linux环境下运行的一款开源Java应用服务器,由Red Hat公司维护。这个版本发布于2012年,它引入了许多改进和新特性,旨在提供更快的启动速度、更高的性能以及更好的模块化。在这个环境中,...
【标题】:“MyEclipse中配置JBoss” 在IT行业中,MyEclipse是一款深受开发者喜爱的集成开发环境(IDE),尤其对于Java EE项目开发来说,它提供了强大的支持。而JBoss则是一个开源的应用服务器,广泛用于部署和管理...
【JBoss 概述】 JBoss 是一个开源的、基于Java的、全面实现了J2EE规范的应用服务器。它提供了企业级的功能,如EJB(Enterprise JavaBeans)、JMS(Java Message Service)、JTS/JTA(Java Transaction Service / ...
"在IntelliJ IDEA 8中部署Jboss服务器图解" IntelliJ IDEA 8是 JetBrains 公司开发的一款功能强大且灵活的集成开发环境(IDE),它支持多种programming语言,包括Java、Python、Ruby、PHP等。Jboss则是一款流行的...
JavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-commonJavaEE源代码 jboss-...
jboss配置入门 jboss系统是一种基于Java的应用服务器,具有高性能、可扩展、安全性强等特点。在本文中,我们将对jboss的基本配置进行介绍,包括其文件夹结构、配置文件、负载均衡配置等。 jboss文件夹结构 jboss的...
【JBoss EAP 7.2.6 补丁包详解】 JBoss Enterprise Application Platform (EAP) 是 Red Hat 提供的一款开源中间件,用于构建、部署和管理企业级 Java 应用程序。JBoss EAP 7.2.6 版本是一个重要的更新,包含了多个...
JBoss是著名的开源Java应用服务器,它基于Java EE(Enterprise Edition)规范,为开发者提供了全面的中间件服务。4.0.5.GA版本是JBoss的一个稳定版本,发布于2006年,适用于那些需要可靠且成熟的Java应用程序部署的...
JBoss是一款著名的开源Java应用服务器,它提供了许多企业级服务,包括事务管理、安全性和集群功能。在开发过程中,为了提高效率,我们通常希望在不中断应用服务的情况下更新部署的应用程序,这就是所谓的“热部署”...
本文档提供了jboss7开发和部署的详细指导,涵盖了jboss7的下载与安装、Eclipse中配置jboss7、项目部署和JNDI获取等方面的内容,旨在帮助开发者快速上手jboss7,并将jboss4.2版本平滑地移植到jboss7。
在JBoss 7及以上版本中,对EJB的配置过程相较于之前的版本有所变化,主要涉及到两个关键的配置文件:`jboss-ejb3.xml`和`ejb-jar.xml`。 `ejb-jar.xml`文件是EJB模块的标准配置文件,遵循Java EE规范。在这个文件中...
某大牛写的jboss-exp 1. 查看系统名称 java -jar jboss_exploit_fat.jar -i http://192.168.7.84:10081/invoker/JMXInvokerServlet get jboss.system:type=ServerInfo OSName 2. 查看系统版本 java -jar jboss_...
JBoss AS7 是一个开源的Java应用服务器,它是JBoss企业应用平台(EAP)的社区版本。JBoss AS7官方手册是关于如何配置、部署和管理JBoss AS7应用服务器的一份权威指南。该手册由Francesco Marchioni撰写,旨在帮助读者...
在IT行业中,JBoss是一个广泛使用的Java应用服务器,它提供了许多功能,如部署和管理Web应用程序、事务处理、安全管理等。对于Windows用户来说,将JBoss配置为系统服务可以实现自动启动,避免每次开机时手动开启,...