簡體   English   中英

如何使用自定義身份驗證方法配置JBoss 6

[英]How to configure JBoss 6 with custom auth-method

也許我可以問問您是否可以幫助我如何使用自定義身份驗證方法配置JBoss 6?
我們從JBoss 5遷移到JBoss6。在5中,我們獲得了帶有該登錄標記的web.xml。

<login-config>
<auth-method>OURSSO</auth-method>
<realm-name>oursso</realm-name>
</login-config>

還有一個jboss-app.xml

<security-domain>oursso</security-domain>

並在login-config.xml中

<application-policy name="oursso">
<authentication>
<login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="sufficient">
<module-option name="usersProperties">props/mycomp-users.properties</module-option>
<module-option name="rolesProperties">props/mycomp-roles.properties</module-option>
<module-option name="unauthenticatedIdentity">anonymous</module-option>
</login-module>
<login-module code="rsa.ps.ct.jboss.jaas.OURSSOServerLoginModule" flag="required">
<module-option name="connectionProvider">rsa.access.manager:type=Service,name=RuntimeAPIClient</module-option>
</login-module>
<login-module code="org.jboss.security.auth.spi.RoleMappingLoginModule" flag="optional">
<module-option name="rolesProperties">props/mycomp-rolemapping-roles.properties</module-option>
<module-option name="replaceRole">true</module-option>
</login-module>
</authentication>
</application-policy>

在war-deployers-jboss-beans.xml中

<property name="authenticators">
<map class="java.util.Properties" keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
<key>BASIC</key>
<value>org.apache.catalina.authenticator.BasicAuthenticator</value>
</entry>

...

<entry>
<key>OURSSO</key>
<value>com.mycomp.OurssoAuthenticator</value>
</entry>
</map>         
</property>

似乎web.xml中的auth方法必須與war-deployers-jboss-beans.xml中的密鑰匹配。 在JBoss 6中如何完成相同的工作?

最好的祝福

弗雷德里克

我將它們添加到了standalone-full.xml

<security-domain name="my-security-domain" cache-type="default">
    <authentication>
        <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
            <module-option name="usersProperties" value="file://${jboss.server.config.dir}/users.properties"/>
            <module-option name="rolesProperties" value="file://${jboss.server.config.dir}/roles.properties"/>
        </login-module>
    </authentication>
</security-domain>

在文件users.properties中

123=qwe
456=asd

在文件role.properties中

123=role.A,role.B
456=role.B

在服務器中的一個bean中,我用

@Stateless

@SecurityDomain("my-security-domain")
@RolesAllowed("role.A")
public class SecureStatelessBean extends SecureReturnAString implements SecureStatelessBeanLocal, SecureStatelessBeanRemote
{
 ...

在我的Web應用程序(在同一服務器上運行)中,我查找Bean並使用此代碼登錄

@EJB(lookup = "java:global/ejbtest-app/ejbtest-server-0.0.1-SNAPSHOT/SecureStatelessBean!se.albinoni.ejbtest.stateless.SecureStatelessBeanRemote")
private SecureStatelessBeanRemote secureStatelessBeanRemote;

...

private static SecurityClient getClientLogin() throws Exception
{
    final SecurityClient client = SecurityClientFactory.getSecurityClient();
    client.setSimple("123", "qwe");
    return client;
}

...

SecurityClient client = getClientLogin();
client.login();

secureStatelessBeanRemote.someMethod();  

認為就是這樣。 但是我仍然沒有找到如何從遠程獨立應用程序執行相同的操作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM