OK, I'm using the web.xml and:

            configuration = new Configuration().randomHttpPort();
            final Map<String, String> userMap = new HashMap<>();
            userMap.put("tomcat", "password");
            configuration.setUsers(userMap);
            final Map<String, String> roleMap = new HashMap<>();
            roleMap.put("my-role", "tomcat");
            configuration.setRoles(userMap);
            container = new Container();
            container.setup(configuration);
            container.start();
            container.deployClasspathAsWebApp("/apppath/", null);
            log.debug(String.format("TomEE embedded started on %s:%s",
                    configuration.getHost(), configuration.getHttpPort()));

The org.apache.tomee.embedded.Container is ignoring the web.xml:

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected Resource</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>my-role</role-name>
        </auth-constraint>
    </security-constraint>

    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>My Realm</realm-name>
    </login-config>

    <security-role>
        <role-name>my-role</role-name>
    </security-role>




--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675857.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to