2 Replies Latest reply on Mar 17, 2014 6:22 AM by ctomc

    Custom LoginModule self registration - is it possible

    alexandre.nikolov

      Is it possible to have a custom log-in module located inside a WAR archive that is self-registering on deployment withot the need to cchange anything in standalone.xml or domain.xml configuration files?

       

      If that is possible - how?

      Belo is the content of some of the configuration file in my test app:

       

      WEB-INF/web.xml

          <security-constraint>

              <display-name>Constraint1</display-name>

              <web-resource-collection>

                  <web-resource-name>protected</web-resource-name>

                  <description/>

                  <url-pattern>/pubsub/protected</url-pattern>

              </web-resource-collection>

              <auth-constraint>

                  <description/>

                  <role-name>testRole1</role-name>

              </auth-constraint>

          </security-constraint>

          <login-config>

              <auth-method>BASIC</auth-method>

              <realm-name>testRealm</realm-name>

          </login-config>

          <security-role>

              <description/>

              <role-name>testRole1</role-name>

          </security-role>

       

      WEB-INF/jboss-web.xml

      <jboss-web>

          <security-domain>testRealm</security-domain>

      </jboss>

       

      All works fine if I have the following entry in standalone.xml:

       

      ...................

              <subsystem xmlns="urn:jboss:domain:security:1.2">

      ...................................................

                  <security-domains>

                      <security-domain name="testRealm" cache-type="default">

                          <authentication>

                              <login-module code="com.mycompany.test.TestLoginModule" flag="required" module="deployment.TestLogin-1.0-SNAPSHOT.war">

                                  <module-option name="username" value="test"/>

                                  <module-option name="password" value="test"/>

                                  <module-option name="roles" value="testRole1,testRole2"/>

                              </login-module>

                          </authentication>

                      </security-domain>

      ..............................

       

      The above module options are specific and provide "default" user log-in and roles - just for the test.

       

      Is it possible to provide all the required configuration inside the WAR and make it work without any changes to the server configuration.