You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by sgjava <sg...@gmail.com> on 2015/08/07 22:48:31 UTC
Using basic auth with tomee-embedded
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.
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
Perfect, thanks!
On Sat, Aug 8, 2015 at 9:34 AM, Romain Manni-Bucau <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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 <
> rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
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.
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
It will never make it into the method to debug:
@Path("/somepath")
@POST
public final Response getSomeData(final MyDto myDto, @Context final
HttpServletRequest rerquest) {
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675876.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
maybe debug and check
http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html#isUserInRole(java.lang.String)
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-13 13:51 GMT-07:00 sgjava <sg...@gmail.com>:
> Forgot client:
>
> // Set up web client with logging filter
> final Client client = ClientBuilder.newClient().register(
> ClientRequestLoggingFilter.class).register(
> new ClientRequestAuthFilter("tomcat", "password"));
>
> public class ClientRequestAuthFilter implements ClientRequestFilter {
>
> /**
> * User.
> */
> private final String user;
> /**
> * Password.
> */
> private final String password;
>
> public ClientRequestAuthFilter(String user, String password) {
> this.user = user;
> this.password = password;
> }
>
> /**
> *
> * @param requestContext
> * @throws IOException
> */
> public void filter(ClientRequestContext requestContext) throws
> IOException {
> MultivaluedMap<String, Object> headers =
> requestContext.getHeaders();
> final String basicAuthentication = getBasicAuthentication();
> headers.add("Authorization", basicAuthentication);
>
> }
>
> /**
> *
> * @return
> */
> private String getBasicAuthentication() {
> String token = this.user + ":" + this.password;
> try {
> return "BASIC " + DatatypeConverter.printBase64Binary(token.
> getBytes("UTF-8"));
> } catch (UnsupportedEncodingException ex) {
> throw new IllegalStateException("Cannot encode with UTF-8",
> ex);
> }
> }
> }
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675874.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
Forgot client:
// Set up web client with logging filter
final Client client = ClientBuilder.newClient().register(
ClientRequestLoggingFilter.class).register(
new ClientRequestAuthFilter("tomcat", "password"));
public class ClientRequestAuthFilter implements ClientRequestFilter {
/**
* User.
*/
private final String user;
/**
* Password.
*/
private final String password;
public ClientRequestAuthFilter(String user, String password) {
this.user = user;
this.password = password;
}
/**
*
* @param requestContext
* @throws IOException
*/
public void filter(ClientRequestContext requestContext) throws
IOException {
MultivaluedMap<String, Object> headers =
requestContext.getHeaders();
final String basicAuthentication = getBasicAuthentication();
headers.add("Authorization", basicAuthentication);
}
/**
*
* @return
*/
private String getBasicAuthentication() {
String token = this.user + ":" + this.password;
try {
return "BASIC " + DatatypeConverter.printBase64Binary(token.
getBytes("UTF-8"));
} catch (UnsupportedEncodingException ex) {
throw new IllegalStateException("Cannot encode with UTF-8", ex);
}
}
}
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675874.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
OK, web.xml is being picked up now, but I get javax.ws.rs.ForbiddenException:
HTTP 403 Forbidden using:
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(roleMap);
container = new Container();
container.setup(configuration);
container.start();
container.deployClasspathAsWebApp("/project/", new File(
"src/main/webapp"));
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675873.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
OK, cool, I knew you'd know how to fix it, thanks!
On Thu, Aug 13, 2015 at 3:28 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> deployClasspathAsWebApp uses the classpath so either use
> .securityConstaint() or add your web.xml to the classpath. In
> deployClasspathAsWebApp() you can set the base (src/main/webapp) instead of
> null as well.
>
>
> 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-13 12:22 GMT-07:00 sgjava <sg...@gmail.com>:
>
> > Right, it deploys fine as a compressed war to TomEE stand-alone. I'm only
> > having a problem running with test Container using exploded war with
> > container.deployClasspathAsWebApp("/project/", null); It doesn't pick up
> > security-constraint, but the rest of the app works fine.
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675870.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>
--
Steven P. Goldsmith
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
deployClasspathAsWebApp uses the classpath so either use
.securityConstaint() or add your web.xml to the classpath. In
deployClasspathAsWebApp() you can set the base (src/main/webapp) instead of
null as well.
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-13 12:22 GMT-07:00 sgjava <sg...@gmail.com>:
> Right, it deploys fine as a compressed war to TomEE stand-alone. I'm only
> having a problem running with test Container using exploded war with
> container.deployClasspathAsWebApp("/project/", null); It doesn't pick up
> security-constraint, but the rest of the app works fine.
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675870.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
Right, it deploys fine as a compressed war to TomEE stand-alone. I'm only
having a problem running with test Container using exploded war with
container.deployClasspathAsWebApp("/project/", null); It doesn't pick up
security-constraint, but the rest of the app works fine.
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675870.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
so then you need to deploy your actual WAR with web.xml inside as usual.
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-13 12:16 GMT-07:00 sgjava <sg...@gmail.com>:
> I'm using <packaging>war</packaging> and my web.xml is in
> project/src/main/webapp/WEB-INF which is the normal place for Maven war. It
> ends up in target/project/WEB-INF:
>
> <web-app 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_2_5.xsd"
> metadata-complete="false"
> version="2.5">
>
> <display-name>My Project</display-name>
>
> <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>
> </web-app>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675868.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
I'm using <packaging>war</packaging> and my web.xml is in
project/src/main/webapp/WEB-INF which is the normal place for Maven war. It
ends up in target/project/WEB-INF:
<web-app 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_2_5.xsd"
metadata-complete="false"
version="2.5">
<display-name>My Project</display-name>
<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>
</web-app>
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675868.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
it is,
is your web.xml in src/main/resources/META-INF/resources/WEB-INF or is
webapp base set properly?
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-13 10:59 GMT-07:00 sgjava <sg...@gmail.com>:
> I'm using 7.0.0-SNAPSHOT :) Is this not working?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675863.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>
Re: Using basic auth with tomee-embedded
Posted by sgjava <sg...@gmail.com>.
I'm using 7.0.0-SNAPSHOT :) Is this not working?
--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/Using-basic-auth-with-tomee-embedded-tp4675786p4675863.html
Sent from the TomEE Users mailing list archive at Nabble.com.
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
Excellent!
On Mon, Aug 10, 2015 at 1:14 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> IIRC it is:
>
> users -> username=password
> roles -> role=user1,user2
>
> As in tomcat embedded
>
>
> 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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > 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 <
> > rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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 <
> > > > > > rmannibucau@gmail.com>
> > > > > > 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 <sg...@gmail.com>:
> > > > > > >
> > > > > > > > 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 <
> > > > > > > rmannibucau@gmail.com>
> > > > > > > > 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 <
> sgjava@gmail.com
> > >:
> > > > > > > > >
> > > > > > > > > > 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 <
> > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > 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 <sg...@gmail.com>:
> > > > > > > > > > >
> > > > > > > > > > > > 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
> >
>
--
Steven P. Goldsmith
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
2015-08-13 9:44 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> 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>
>
If you are not using the snapshot yes otherwise it shouldnt
>
> On Mon, Aug 10, 2015 at 2:12 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > it does but you can set them through the API as well. Depends your setup
> >
> >
> > 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 10:40 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > The container doesn't appear to pick up the <security-constraint>, etc.
> > > from the web.xml.
> > >
> > > On Mon, Aug 10, 2015 at 1:14 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com
> > > >
> > > wrote:
> > >
> > > > IIRC it is:
> > > >
> > > > users -> username=password
> > > > roles -> role=user1,user2
> > > >
> > > > As in tomcat embedded
> > > >
> > > >
> > > > 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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> > > >
> > > > > 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 <
> > > > > rmannibucau@gmail.com>
> > > > > 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 <sg...@gmail.com>:
> > > > > >
> > > > > > > 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 <
> > > > > > > rmannibucau@gmail.com>
> > > > > > > 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 <sgjava@gmail.com
> >:
> > > > > > > >
> > > > > > > > > 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 <
> > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > 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 <
> > sgjava@gmail.com
> > > >:
> > > > > > > > > >
> > > > > > > > > > > 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 <
> > > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > > 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 <
> > > > sgjava@gmail.com
> > > > > >:
> > > > > > > > > > > >
> > > > > > > > > > > > > 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
> <
> > > > > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > > > > 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 <
> > sgjava@gmail.com
> > > >:
> > > > > > > > > > > > > >
> > > > > > > > > > > > > > > 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
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Steven P. Goldsmith
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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>
On Mon, Aug 10, 2015 at 2:12 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> it does but you can set them through the API as well. Depends your setup
>
>
> 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 10:40 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > The container doesn't appear to pick up the <security-constraint>, etc.
> > from the web.xml.
> >
> > On Mon, Aug 10, 2015 at 1:14 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com
> > >
> > wrote:
> >
> > > IIRC it is:
> > >
> > > users -> username=password
> > > roles -> role=user1,user2
> > >
> > > As in tomcat embedded
> > >
> > >
> > > 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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> > >
> > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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 <
> > > > > > rmannibucau@gmail.com>
> > > > > > 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 <sg...@gmail.com>:
> > > > > > >
> > > > > > > > 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 <
> > > > > > > > rmannibucau@gmail.com>
> > > > > > > > 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 <
> sgjava@gmail.com
> > >:
> > > > > > > > >
> > > > > > > > > > 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 <
> > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > 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 <
> > > sgjava@gmail.com
> > > > >:
> > > > > > > > > > >
> > > > > > > > > > > > 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 <
> > > > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > > > 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 <
> sgjava@gmail.com
> > >:
> > > > > > > > > > > > >
> > > > > > > > > > > > > > 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
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>
--
Steven P. Goldsmith
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
it does but you can set them through the API as well. Depends your setup
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 10:40 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> The container doesn't appear to pick up the <security-constraint>, etc.
> from the web.xml.
>
> On Mon, Aug 10, 2015 at 1:14 PM, Romain Manni-Bucau <rmannibucau@gmail.com
> >
> wrote:
>
> > IIRC it is:
> >
> > users -> username=password
> > roles -> role=user1,user2
> >
> > As in tomcat embedded
> >
> >
> > 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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > 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 <
> > > rmannibucau@gmail.com>
> > > 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 <sg...@gmail.com>:
> > > >
> > > > > 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 <
> > > > > rmannibucau@gmail.com>
> > > > > 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 <sg...@gmail.com>:
> > > > > >
> > > > > > > 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 <
> > > > > > > rmannibucau@gmail.com>
> > > > > > > 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 <sgjava@gmail.com
> >:
> > > > > > > >
> > > > > > > > > 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 <
> > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > 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 <
> > sgjava@gmail.com
> > > >:
> > > > > > > > > >
> > > > > > > > > > > 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 <
> > > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > > 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 <sgjava@gmail.com
> >:
> > > > > > > > > > > >
> > > > > > > > > > > > > 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
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
The container doesn't appear to pick up the <security-constraint>, etc.
from the web.xml.
On Mon, Aug 10, 2015 at 1:14 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:
> IIRC it is:
>
> users -> username=password
> roles -> role=user1,user2
>
> As in tomcat embedded
>
>
> 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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
>
> > 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 <
> > rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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 <
> > > > > > rmannibucau@gmail.com>
> > > > > > 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 <sg...@gmail.com>:
> > > > > > >
> > > > > > > > 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 <
> > > > > > > rmannibucau@gmail.com>
> > > > > > > > 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 <
> sgjava@gmail.com
> > >:
> > > > > > > > >
> > > > > > > > > > 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 <
> > > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > > 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 <sg...@gmail.com>:
> > > > > > > > > > >
> > > > > > > > > > > > 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
> >
>
--
Steven P. Goldsmith
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
IIRC it is:
users -> username=password
roles -> role=user1,user2
As in tomcat embedded
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 10:13 GMT-07:00 Steve Goldsmith <sg...@gmail.com>:
> 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 <
> rmannibucau@gmail.com>
> 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 <sg...@gmail.com>:
> >
> > > 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 <
> > > rmannibucau@gmail.com>
> > > 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 <sg...@gmail.com>:
> > > >
> > > > > 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 <
> > > > > rmannibucau@gmail.com>
> > > > > 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 <sg...@gmail.com>:
> > > > > >
> > > > > > > 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 <
> > > > > > rmannibucau@gmail.com>
> > > > > > > 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 <sgjava@gmail.com
> >:
> > > > > > > >
> > > > > > > > > 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 <
> > > > > > > > rmannibucau@gmail.com>
> > > > > > > > > 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 <sg...@gmail.com>:
> > > > > > > > > >
> > > > > > > > > > > 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
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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 <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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 <
> > rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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 <
> > > > > rmannibucau@gmail.com>
> > > > > > 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 <sg...@gmail.com>:
> > > > > > >
> > > > > > > > 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 <
> > > > > > > rmannibucau@gmail.com>
> > > > > > > > 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 <sg...@gmail.com>:
> > > > > > > > >
> > > > > > > > > > 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
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:
> 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 <
> rmannibucau@gmail.com>
> 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 <sg...@gmail.com>:
> >
> > > 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 <
> > > rmannibucau@gmail.com>
> > > 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 <sg...@gmail.com>:
> > > >
> > > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > > 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 <sg...@gmail.com>:
> > > > > >
> > > > > > > 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 <
> > > > > > rmannibucau@gmail.com>
> > > > > > > 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 <sg...@gmail.com>:
> > > > > > > >
> > > > > > > > > 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
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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 <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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 <
> > rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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 <
> > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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 <
> > > > > rmannibucau@gmail.com>
> > > > > > 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 <sg...@gmail.com>:
> > > > > > >
> > > > > > > > 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
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:
> 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 <
> rmannibucau@gmail.com>
> 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 <sg...@gmail.com>:
> >
> > > 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 <
> > rmannibucau@gmail.com>
> > > 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 <sg...@gmail.com>:
> > > >
> > > > > 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 <
> > > > rmannibucau@gmail.com>
> > > > > 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 <sg...@gmail.com>:
> > > > > >
> > > > > > > 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
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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 <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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 <
> rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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 <
> > > rmannibucau@gmail.com>
> > > > 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 <sg...@gmail.com>:
> > > > >
> > > > > > 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
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:
> 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 <rm...@gmail.com>
> 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 <sg...@gmail.com>:
> >
> > > 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 <
> > rmannibucau@gmail.com>
> > > 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 <sg...@gmail.com>:
> > > >
> > > > > 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
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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 <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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 <
> rmannibucau@gmail.com>
> > 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 <sg...@gmail.com>:
> > >
> > > > 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
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:
> 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 <rm...@gmail.com>
> 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 <sg...@gmail.com>:
> >
> > > 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
>
Re: Using basic auth with tomee-embedded
Posted by Steve Goldsmith <sg...@gmail.com>.
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 <rm...@gmail.com>
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 <sg...@gmail.com>:
>
> > 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
Re: Using basic auth with tomee-embedded
Posted by Romain Manni-Bucau <rm...@gmail.com>.
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 <sg...@gmail.com>:
> 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.
>