ITeye博客

请教:Jboss jaas 进行安全性验证在ejb3中

bd2007 · 2011-08-11 17:08 · java · Markdown

最近在研究jaas 我配置了 jboss-web.xml java:/jaas/ioffice
login-config.xml 以及login.config文件 ioffice { // a properties file loginmodule that supports callerprincipal mapping org.jboss.security.clientloginmodule required unauthenticatedidentity=nobody; }; 我在 ejb3中进行测试 hashtable props = new hashtable(); props.put(context.initial_context_factory, "org.jnp.interfaces.namingcontextfactory"); props.put(context.url_pkg_prefixes, "org.jboss.naming:org.jnp.interfaces"); props.put(context.provider_url, "jnp://localhost:1099");

	iofficecallbackhandler handler = new iofficecallbackhandler(
			"admin@ben.ioe.cn", "admin".tochararray());
	
	
	logincontext lc = new logincontext("ioffice", (callbackhandler) handler);
	lc.login();

initialcontext ctx = new initialcontext(props);

	basic = (publicbasic) ctx.lookup("publicbasicbean/remote");

在publicbasicbean中 @stateless @remote(publicbasic.class) @securitydomain("ioffice") public class publicbasicbean implements publicbasic { @rolesallowed({ "basicuser", "domainadministrator", "poweruser" }) public java.util.collection getprivatecontacts() { try { return xxx.... } catch (exception e) {

	}
}

} 为什么出现 javax.ejb.ejbaccessexception: caller unauthorized at org.jboss.ejb3.security.rolebasedauthorizationinterceptorv2.invoke(rolebasedauthorizationinterceptorv2.java:199) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) at org.jboss.ejb3.security.ejb3authenticationinterceptorv2.invoke(ejb3authenticationinterceptorv2.java:186) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) at org.jboss.ejb3.encpropagationinterceptor.invoke(encpropagationinterceptor.java:41) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) at org.jboss.ejb3.blockcontainershutdowninterceptor.invoke(blockcontainershutdowninterceptor.java:67) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) at org.jboss.aspects.currentinvocation.currentinvocationinterceptor.invoke(currentinvocationinterceptor.java:67) at org.jboss.aop.joinpoint.methodinvocation.invokenext(methodinvocation.java:102) at org.jboss.ejb3.stateless.statelesscontainer.dynamicinvoke(statelesscontainer.java:421) at org.jboss.ejb3.session.invokablecontextclassproxyhack._dynamicinvoke(invokablecontextclassproxyhack.java:53) at org.jboss.aop.dispatcher.invoke(dispatcher.java:91) at org.jboss.aspects.remoting.aopremotinginvocationhandler.invoke(aopremotinginvocationhandler.java:82) 希望高手能给解决一下,并给讲讲jaas

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。