9 Replies Latest reply on Mar 5, 2014 12:52 AM by Rituraj Sinha

    Simple sample basic authentication

    Fernando Soares Newbie

      Hello

      After read several times the wildfly documentation about security realms I think that a working example will be fine.

      I saw these in the standalone.xml:

      <security-realm name="ApplicationRealm">

        <authentication>

          <local default-user="$local" allowed-users="*"/>

          <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>

        </authentication>

        <authorization>

          <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>

        </authorization>

      </security-realm>

       

      and I think that I can add users and roles with add-user.sh

       

      My problem is how to map these to the web.xml of my app.

       

      <security-constraint>

              <web-resource-collection>

                  <web-resource-name>Viz Data Proxy</web-resource-name>

                  <url-pattern>*.html</url-pattern>

                  <http-method>GET</http-method>

                  <http-method>POST</http-method>

              </web-resource-collection>

       

       

              <auth-constraint>

                  <role-name>vizadmin</role-name>

              </auth-constraint>

          </security-constraint>

          <login-config>

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

              <realm-name>file</realm-name>

          </login-config>

       

       

          <security-role>

              <role-name>vizadmin</role-name>

          </security-role>

       

      These is a working sample with glassfish.

      Can someone help me?