2014-01-10 48 views
0

我试图建立一个CXF +弹簧+内嵌有基本身份验证依靠JAAS码头,我有问题,所有的碎片连接。配置JAAS与CXF嵌入式Jetty和春天

我想使用CXF JAASLoginInterceptor,看起来很容易配置,以便在ApplicationContext中我的服务定义看起来像

<jaxws:endpoint address="/soapService"> 
    <jaxrs:serviceBeans> 
     <ref bean="serviceImpl" /> 
    </jaxrs:serviceBeans> 
    <jaxws:inInterceptors> 
     <ref bean="authenticationInterceptor"/> 
    </jaxws:inInterceptors> 
</jaxws:endpoint> 

<bean id="authenticationInterceptor" class="org.apache.cxf.interceptor.security.JAASLoginInterceptor"> 
    <property name="contextName" value="jaasContext"/> 
    <property name="roleClassifier" value="ROLE_"/> 
</bean> 

由于DOC规定:“JAAS认证配置了的名字JAAS登录上下文(通常在JAAS配置资源中指定的其中一个服务器是知道的)”

我怎么能设置是‘JAAS配置资源’的最基本的方法是什么?

谢谢!

回答

1

在年底这是很容易做到这一点。你唯一需要的是放置在类路径登录模块的配置文件和设置系统属性“java.security.auth.login.config”指向该文件。

例如一个文件,以使基于属性文件验证:

jaasContext {
org.eclipse.jetty.plus.jaas.spi.PropertyFileLoginModule可选 文件= “SRC /主/资源/ credentials.props”; };

注意的是,在CXF拦截器的CONTEXTNAME是一样的,在JAAS配置文件。