Jboss login and redirect to correct url

2019-09-04 18:09发布

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.

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.

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

1条回答
叛逆
2楼-- · 2019-09-04 18:20

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.

    Authentication any name *.jsf GET POST admin NONE

  2. The login config

    FORM realm name /mylogin.jsf /myerror.jsf

  3. security role

    desc admin

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

<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.

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

<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>
查看更多
登录 后发表回答