0 Replies Latest reply on Nov 13, 2016 4:31 PM by Jon Kristensen

    Can authentication and authorization annotations replace this web.xml?

    Jon Kristensen Newbie

      Hi!

       

      My application contains the web.xml file below.

       

      My question is: Could some of these be provided by annotations, instead? (Preferably, I would no longer have a web.xml file, and any annotations used would be general to Java EE (that is, not specific WildFly).)

       

      I'm using the latest version of WildFly and Java EE 7.

       

      <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">

        <login-config>

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

        </login-config>

        <security-constraint>

          <web-resource-collection>

            <web-resource-name>Administrator</web-resource-name>

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

          </web-resource-collection>

          <auth-constraint>

            <role-name>Administrator</role-name>

          </auth-constraint>

        </security-constraint>

        <security-role>

          <role-name>Administrator</role-name>

        </security-role>

      </web-app>

       

      Thanks!

       

      All the best,

      Jon