Skip to main content


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 06:53 Go to next message
Ashish Shinde is currently offline Ashish ShindeFriend
Messages: 21
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 06:41 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
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 07:57 Go to previous message
Ashish Shinde is currently offline Ashish ShindeFriend
Messages: 21
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: Fri Apr 19 16:05:34 GMT 2024

Powered by FUDForum. Page generated in 0.01806 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top