Jboss登录并重定向到正确的URL

时间:2022-10-20 09:26:48

I have this problem and i just cannot find a solution to it.

我有这个问题,我只是找不到解决方案。

I am using JBoss AS 7 and created a dynamic web project using Eclipse Indigo. From my project i created a simple login form whereby after correctly logging in i should be directed to my appropriate section.

我正在使用JBoss AS 7并使用Eclipse Indigo创建了一个动态Web项目。从我的项目中我创建了一个简单的登录表单,在正确登录之后,我应该将其定向到我的相应部分。

Users, Roles and Groups should be managed by jboss and not the project. So jboss should decide where to redirect me after checking in the correct properties files.

用户,角色和组应由jboss而不是项目管理。所以jboss应该在签入正确的属性文件后决定在哪里重定向。

How can i do this? Can you all help me please.

我怎样才能做到这一点?请大家帮忙。

1 个解决方案

#1


0  

Well i finally got it. Three simple steps to follow.

好吧,我终于明白了。要遵循的三个简单步骤。

  1. In the web.xml file, put all your security constraints according to the roles.

    在web.xml文件中,根据角色放置所有安全约束。

    Authentication any name *.jsf GET POST admin NONE

    验证任何名称* .jsf GET POST admin NONE

  2. The login config

    登录配置

    FORM realm name /mylogin.jsf /myerror.jsf

    FORM领域名称/mylogin.jsf /myerror.jsf

  3. security role

    desc admin

  4. 安全角色desc admin

Create a jboss-web.xml file in the WEB-INF folder. Inside this file, write

在WEB-INF文件夹中创建一个jboss-web.xml文件。在这个文件里面写

<jboss-web>
    <security-domain>java:/jaas/realmname</security-domain>
</jboss-web>

Create a folder classes in the WEB-INF folder and place your user.properties and role.properties file in it.

在WEB-INF文件夹中创建文件夹类,并将user.properties和role.properties文件放在其中。

And then the final step is to add the configuration in the standalone.xml file

然后最后一步是在standalone.xml文件中添加配置

<security-domain name="realmname">
                    <authentication>
                        <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
                            <module-option name="usersProperties" value="users.properties"/>
                            <module-option name="rolesProperties" value="roles.properties"/>
                        </login-module>
                    </authentication>
                </security-domain>

#1


0  

Well i finally got it. Three simple steps to follow.

好吧,我终于明白了。要遵循的三个简单步骤。

  1. In the web.xml file, put all your security constraints according to the roles.

    在web.xml文件中,根据角色放置所有安全约束。

    Authentication any name *.jsf GET POST admin NONE

    验证任何名称* .jsf GET POST admin NONE

  2. The login config

    登录配置

    FORM realm name /mylogin.jsf /myerror.jsf

    FORM领域名称/mylogin.jsf /myerror.jsf

  3. security role

    desc admin

  4. 安全角色desc admin

Create a jboss-web.xml file in the WEB-INF folder. Inside this file, write

在WEB-INF文件夹中创建一个jboss-web.xml文件。在这个文件里面写

<jboss-web>
    <security-domain>java:/jaas/realmname</security-domain>
</jboss-web>

Create a folder classes in the WEB-INF folder and place your user.properties and role.properties file in it.

在WEB-INF文件夹中创建文件夹类,并将user.properties和role.properties文件放在其中。

And then the final step is to add the configuration in the standalone.xml file

然后最后一步是在standalone.xml文件中添加配置

<security-domain name="realmname">
                    <authentication>
                        <login-module code="org.jboss.security.auth.spi.UsersRolesLoginModule" flag="required">
                            <module-option name="usersProperties" value="users.properties"/>
                            <module-option name="rolesProperties" value="roles.properties"/>
                        </login-module>
                    </authentication>
                </security-domain>