9 Replies Latest reply on May 16, 2014 10:21 AM by simas_ch

    security constraint does not work

    simas_ch

      Hi,

       

      I'm trying to migrate an application from GlassFish to WildFly.

       

      I have some security constraints in my web.xml

       

      <security-constraint>

        <display-name>Spaces</display-name>

        <web-resource-collection>

          <web-resource-name>spaces</web-resource-name>

          <url-pattern>/spaces/*</url-pattern>

        </web-resource-collection>

        <auth-constraint>

          <role-name>user</role-name>

        </auth-constraint>

      </security-constraint>

       

      <login-config>

        <auth-method>FORM</auth-method>

        <realm-name>jtaf</realm-name>

        <form-login-config>

          <form-login-page>/login.html</form-login-page>

          <form-error-page>/login_error.html</form-error-page>

        </form-login-config>

      </login-config>

       

      <security-role>

        <role-name>user</role-name>

      </security-role>

       

      My jboss-web.xml looks like this

       

      <jboss-web>

          <context-root>/jtaf</context-root>

          <security-domain>java:/jaas/jtaf</security-domain>

      </jboss-web>

       

      And in standalone.xml I have

       

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

        <authentication>

          <login-module code="Database" flag="required">

            <module-option name="dsJndiName" value="java:jboss/datasources/jtaf"/>

            <module-option name="principalsQuery" value="select secret from securityuser where email = ?"/>

            <module-option name="rolesQuery" value="select name from securitygroup where email = ?"/>

            <module-option name="password-stacking" value="useFirstPass"/>

            <module-option name="hashAlgorithm" value="MD5"/>

            <module-option name="hashEncoding" value="base64"/>

          </login-module>

        </authentication>

      </security-domain>

       

      But when I access https://localhost:8443/jtaf/spaces/index.html it does not redirect to the login form.

       

      What's wrong with my configuration?

       

      Thanks, Simon