New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding security-domain and insert database on local jboss setup #1

Open
quangtin3 opened this Issue Dec 27, 2013 · 1 comment

Comments

Projects
None yet
2 participants
@quangtin3

quangtin3 commented Dec 27, 2013

Before we can running this extjs-rest-java-hibernate application on local jBoss, some works need to be done:

Setup DataSource

  • Create MySQL driver Module
  • Prepare an user on MySQL database with: src/main/resources/import.sql
  • Create datasource, for example in your jBoss's standalone.xml add:
<datasources>
    <datasource jndi-name="java:jboss/datasources/MysqlDS" pool-name="extjsDS" enabled="true" use-java-context="true">
        <connection-url>jdbc:mysql://localhost:3306/extjs?zeroDateTimeBehavior=convertToNull&amp;useUnicode=true&amp;characterEncoding=utf8</connection-url>
        <driver>mysql</driver>
        <security>
        <user-name>extjs</user-name>
        <password>extjs</password>
        </security>
    </datasource>
    <drivers>
        <driver name="mysql" module="com.mysql">
                <xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
        </driver>
    </drivers>
</datasources>

Add security domain, again, in your jBoss's standalone.xml add security domain as following:

<security-domain name="ExtjsMVCTemplateRealm" cache-type="default">
    <authentication>
        <login-module code="Database" flag="required">
            <module-option name="dsJndiName" value="java:jboss/datasources/MysqlDS"/>
            <module-option name="principalsQuery" value="select password from user where username=?"/>
            <module-option name="rolesQuery" value="select role.rolename, 'Roles' from role, userrole where role.id = userrole.roles_id and userrole.users_username=?"/>
            <module-option name="hashAlgorithm" value="MD5"/>
            <module-option name="hashEncoding" value="hex"/>
        </login-module>
    </authentication>
</security-domain>
@endriju

This comment has been minimized.

Show comment
Hide comment
@endriju
Member

endriju commented Dec 27, 2013

Thank you very much!
I linked to the issue from our website http://www.bitfiction.com/extjs-mvc-rest-java-hibernate-application-template-jboss-setup/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment