OK, how do the Maps work org.apache.tomee.embedded.Container? Normally
tomcat-users.xml would have user, role and password. How is this possible
with map? Consider the following:

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

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

    <security-role>
        <role-name>mas-role</role-name>
    </security-role>

<?xml version='1.0' encoding='utf-8'?><tomcat-users>
  <role rolename="mas-role"/>
  <user username="tomcat" password="tomcat" roles="mas-role"/></tomcat-users>



On Mon, Aug 10, 2015 at 11:05 AM, Romain Manni-Bucau <[email protected]>
wrote:

> Dont use EJBContainer and use Container class instead
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-08-10 7:58 GMT-07:00 Steve Goldsmith <[email protected]>:
>
> > I define container as:
> >
> > import javax.ejb.embeddable.EJBContainer;
> >
> > private static EJBContainer container;
> >
> > Should I be using a different EJBContainer?
> >
> > On Mon, Aug 10, 2015 at 10:56 AM, Romain Manni-Bucau <
> > [email protected]>
> > wrote:
> >
> > > Yes it is Container not EmbeddedTomEEContainer.
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-08-10 7:55 GMT-07:00 Steve Goldsmith <[email protected]>:
> > >
> > > > OK, I don't see any methods in EmbeddedTomEEContainer, so using the
> > code
> > > > below where would it go?
> > > >
> > > >             final Map p = new HashMap();
> > > >             p.put(Context.INITIAL_CONTEXT_FACTORY,
> > > >
> > >  "org.apache.openejb.core.LocalInitialContextFactory");
> > > >             p.put("openejb.embedded.initialcontext.close ",
> "DESTROY");
> > > >             p.put("openejb.embedded.remotable", "true");
> > > >             p.put(EJBContainer.APP_NAME, "masblaster");
> > > >             p.put(EJBContainer.PROVIDER, "tomee-embedded");
> > > >             // Add WAR and MDB modules
> > > >             p.put(EJBContainer.MODULES, new
> > > > File[]{Archive.archive().copyTo(
> > > >                 "WEB-INF/classes",
> > > > jarLocation(MasService.class)).asDir()});
> > > >             // Random port
> > > >
>  p.put(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT,
> > > > "-1");
> > > >             container = EJBContainer.createEJBContainer(p);
> > > >
> > > >
> > > > On Mon, Aug 10, 2015 at 10:51 AM, Romain Manni-Bucau <
> > > > [email protected]>
> > > > wrote:
> > > >
> > > > > You can do it using tomee-embedded Container, not EJBContainer.
> Could
> > > be
> > > > > added but a lot of configuration is not yet available in
> > EJBContainer.
> > > > >
> > > > >
> > > > > Romain Manni-Bucau
> > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > https://github.com/rmannibucau> |
> > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > > <http://www.tomitribe.com>
> > > > >
> > > > > 2015-08-10 7:39 GMT-07:00 Steve Goldsmith <[email protected]>:
> > > > >
> > > > > > I'm not seeing where you do setUsers and setRoles with
> EJBContainer
> > > or
> > > > > > EmbeddedTomEEContainer.
> > > > > >
> > > > > > On Sat, Aug 8, 2015 at 9:34 AM, Romain Manni-Bucau <
> > > > > [email protected]>
> > > > > > wrote:
> > > > > >
> > > > > > > config.setUsers(userMap); // and setRoles(rolesMap)
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > Romain Manni-Bucau
> > > > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > > > https://github.com/rmannibucau> |
> > > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> Tomitriber
> > > > > > > <http://www.tomitribe.com>
> > > > > > >
> > > > > > > 2015-08-08 6:31 GMT-07:00 Steve Goldsmith <[email protected]>:
> > > > > > >
> > > > > > > > I understand that part, but you also have to add the user in
> > > > > > > > tomcat-users.xml as well. How would you do that in
> > > tomee-embedded?
> > > > > > > >
> > > > > > > > On Fri, Aug 7, 2015 at 5:11 PM, Romain Manni-Bucau <
> > > > > > > [email protected]>
> > > > > > > > wrote:
> > > > > > > >
> > > > > > > > > Hi, just add a web.xml as in any war
> > > > > > > > >
> > > > > > > > >
> > > > > > > > > Romain Manni-Bucau
> > > > > > > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > > > > > > <http://rmannibucau.wordpress.com> | Github <
> > > > > > > > > https://github.com/rmannibucau> |
> > > > > > > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> |
> > > Tomitriber
> > > > > > > > > <http://www.tomitribe.com>
> > > > > > > > >
> > > > > > > > > 2015-08-07 13:48 GMT-07:00 sgjava <[email protected]>:
> > > > > > > > >
> > > > > > > > > > How you you use basic auth with TomEE Embedded? Any
> > examples
> > > > out
> > > > > > > there?
> > > > > > > > > > This
> > > > > > > > > > is basically what I use for testing:
> > > > > > > > > >
> > > > > > > > > >     /**
> > > > > > > > > >      * Start EJB container. Create configuration, cache
> > > client
> > > > > and
> > > > > > > EJB
> > > > > > > > > >      * container.
> > > > > > > > > >      */
> > > > > > > > > >     @BeforeClass
> > > > > > > > > >     public static void setUpClass() {
> > > > > > > > > >         try {
> > > > > > > > > >             log.info("setUpClass()");
> > > > > > > > > >             // Call super setUpClass
> > > > > > > > > >             BaseTest.setUpClass();
> > > > > > > > > >             // Get configuration
> > > > > > > > > >             final Configuration config =
> > getConfiguration();
> > > > > > > > > >             final Map p = new HashMap();
> > > > > > > > > >             p.put(Context.INITIAL_CONTEXT_FACTORY,
> > > > > > > > > >
> > > > > > > > >  "org.apache.openejb.core.LocalInitialContextFactory");
> > > > > > > > > >             p.put("openejb.embedded.initialcontext.close
> ",
> > > > > > > "DESTROY");
> > > > > > > > > >             p.put("openejb.embedded.remotable", "true");
> > > > > > > > > >             p.put(EJBContainer.APP_NAME, "masblaster");
> > > > > > > > > >             p.put(EJBContainer.PROVIDER,
> "tomee-embedded");
> > > > > > > > > >             // Add WAR and MDB modules
> > > > > > > > > >             p.put(EJBContainer.MODULES, new
> > > > > > > > > > File[]{Archive.archive().copyTo(
> > > > > > > > > >                 "WEB-INF/classes",
> > > > > > > > > > jarLocation(OdnService.class)).asDir()});
> > > > > > > > > >             // Random port
> > > > > > > > > >
> > > > > > >  p.put(EmbeddedTomEEContainer.TOMEE_EJBCONTAINER_HTTP_PORT,
> > > > > > > > > > "-1");
> > > > > > > > > >             container =
> EJBContainer.createEJBContainer(p);
> > > > > > > > > >         } catch (ConfigurationException e) {
> > > > > > > > > >             log.error(e.getMessage());
> > > > > > > > > >         }
> > > > > > > > > >     }
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > >
> > > > > > > > > > --
> > > > > > > > > > View this message in context:
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786.html
> > > > > > > > > > Sent from the TomEE Users mailing list archive at
> > Nabble.com.
> > > > > > > > > >
> > > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > --
> > > > > > > > Steven P. Goldsmith
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Steven P. Goldsmith
> > > > > >
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Steven P. Goldsmith
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Reply via email to