Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [CDO] Enable security manager in embedded server
[CDO] Enable security manager in embedded server [message #1131072] Thu, 10 October 2013 02:53 Go to next message
Ashish Shinde is currently offline Ashish Shinde
Messages: 20
Registered: August 2013
Junior Member
We need to enable security manager for an embedded CDO server (4.2). We are starting the server using code similar to embedded CDO server.

How do we enable security manager in the code snippet above.


Re: [CDO] Enable security manager in embedded server [message #1133995 is a reply to message #1131072] Sat, 12 October 2013 02:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike Stepper
Messages: 5486
Registered: July 2009
Senior Member
Am 10.10.2013 08:53, schrieb Ashish Shinde:
> We need to enable security manager for an embedded CDO server (4.2). We are starting the server using code similar to
> http://wiki.eclipse.org/CDO/Embedded.
>
> How do we enable security manager in the code snippet above.
There's an example in org.eclipse.emf.cdo.server.internal.security.SecurityExtension.configureRepository(Element):

String description = securityManagerElement.getAttribute("description");
if (description == null || description.length() == 0)
{
description = securityManagerElement.getAttribute("realmPath");
}

if (description == null || description.length() == 0)
{
description = DEFAULT_REALM_PATH;
}

InternalSecurityManager securityManager = (InternalSecurityManager)container.getElement(
SecurityManagerFactory.PRODUCT_GROUP, "default", description);
securityManager.setRepository(repository);

It's best do do that before the repository gets activated, but I it's also possible thereafter.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Re: [CDO] Enable security manager in embedded server [message #1138626 is a reply to message #1133995] Tue, 15 October 2013 03:57 Go to previous message
Ashish Shinde is currently offline Ashish Shinde
Messages: 20
Registered: August 2013
Junior Member
Thanks Eike. That worked albeit with a problem. Had to make a call to SecurityManagerUtil.prepareContainer(). However from the looks of it SecurityManager code internally using IPLuginContainer.INSTANCE as the container. Therefore this works only if the container is IPLuginContainer.INSTANCE. I get factory not found exceptions if I use a custom container(even after calling SecurityManagerUtil.prepareContainer()).

For now I could use IPLuginContainer.INSTANCE for tests cases. However if and when tests run in parallel I will be affected I guess.

Eike Stepper wrote on Sat, 12 October 2013 02:41
Am 10.10.2013 08:53, schrieb Ashish Shinde:
> We need to enable security manager for an embedded CDO server (4.2). We are starting the server using code similar to
> http://wiki.eclipse.org/CDO/Embedded.
>
> How do we enable security manager in the code snippet above.
There's an example in org.eclipse.emf.cdo.server.internal.security.SecurityExtension.configureRepository(Element):

String description = securityManagerElement.getAttribute("description");
if (description == null || description.length() == 0)
{
description = securityManagerElement.getAttribute("realmPath");
}

if (description == null || description.length() == 0)
{
description = DEFAULT_REALM_PATH;
}

InternalSecurityManager securityManager = (InternalSecurityManager)container.getElement(
SecurityManagerFactory.PRODUCT_GROUP, "default", description);
securityManager.setRepository(repository);

It's best do do that before the repository gets activated, but I it's also possible thereafter.

Cheers
/Eike

----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper



Previous Topic:[CDO] In-transaction unique ID generator?
Next Topic:[CDO] AbstractCDOIDLong
Goto Forum:
  


Current Time: Thu Jul 31 15:53:38 EDT 2014

Powered by FUDForum. Page generated in 0.11032 seconds