|
|
|
|
Re: [CDO 4.1]Security Manager Problem [message #900498 is a reply to message #900426] |
Tue, 07 August 2012 05:58   |
Eclipse User |
|
|
|
Hi Jörg,
Thanks for taking the time to track this down! I'm currently extending the test bed so that we can more easily inject a
security manager from single test cases. I may come back with questions once that's done...
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 07.08.2012 06:59, schrieb Joerg Pacher:
> Hi Eike,
>
> i experienced this too. After some debugging i tracked it down to a deadlock with the transaction in
> SecurityManager.modify():
>
> {
> synchronized (transaction)
> {
> operation.execute(realm);
>
> try {
> transaction.commit();
> } catch (CommitException ex) {
> throw WrappedException.wrap(ex);
> }
> }
> }
>
> In the commit() call, the attached write acces handler is invoked which tries to resolve the session user via
> getUser(). If the user is unknown, the transaction is used to retrieve it from the realm. As this runs in a separate
> thread it is blocked by the locked transaction.
>
> When the synchronized block is removed, the deadlock is gone, but you may experience other problems.
>
>
> Greetings Joerg.
>
> On 06/20/2012 01:24 PM, Xingxiao Lu wrote:
>> Hi, Eike
>> I use the HEAD of CDO GIT repository.
>> CDOServer: Add 'security' bundles to 'CDOServer' in Run Configuration.
>> Config the securityManager entiry in 'cdo-server.xml'. <securityManager
>> type="default" realmPath="/security"/>
>>
>> CDOClient: I use 'CDOExplorer'.
>>
>> Hope this information will give you help.
>>
>> Thank you for your professional reply.:)
>
|
|
|
Re: [CDO 4.1]Security Manager Problem [message #900677 is a reply to message #900426] |
Wed, 08 August 2012 03:08  |
Eclipse User |
|
|
|
Am 07.08.2012 06:59, schrieb Joerg Pacher:
> Hi Eike,
>
> i experienced this too. After some debugging i tracked it down to a deadlock with the transaction in
> SecurityManager.modify():
>
> {
> synchronized (transaction)
> {
> operation.execute(realm);
>
> try {
> transaction.commit();
> } catch (CommitException ex) {
> throw WrappedException.wrap(ex);
> }
> }
> }
I've solved this by opening a new transaction in ISecurityManager.modify().
I've also added lots of convenience methods to Realm, Directory and ISecurityManager.
And there's an easy test now, which you can use as an example in the future to demo remaining issues:
public class SecurityManagerTest extends AbstractCDOTest
{
private static final String USER_ID = "Stepper";
private static final String PASSWORD = "12345";
public void testCommit() throws Exception
{
ISecurityManager securityManager = startRepository();
securityManager.modify(new ISecurityManager.RealmOperation()
{
public void execute(Realm realm)
{
User user = realm.addUser(USER_ID, PASSWORD);
user.getGroups().add(realm.getGroup("Users"));
user.getRoles().add(realm.getRole("All Objects Writer"));
}
});
CDOSession session = openSession();
CDOTransaction transaction = session.openTransaction();
CDOResource resource = transaction.createResource(getResourcePath("/res"));
resource.getContents().add(getModel1Factory().createProduct1());
transaction.commit();
}
private ISecurityManager startRepository()
{
ISecurityManager securityManager = SecurityManagerUtil.createSecurityManager("/security", getServerContainer());
getTestProperties().put(RepositoryConfig.PROP_TEST_SECURITY_MANAGER, securityManager);
IPasswordCredentialsProvider credentialsProvider = new PasswordCredentialsProvider(USER_ID, PASSWORD);
getTestProperties().put(SessionConfig.PROP_TEST_CREDENTIALS_PROVIDER, credentialsProvider);
getRepository(); // Start repository
return securityManager;
}
}
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> In the commit() call, the attached write acces handler is invoked which tries to resolve the session user via
> getUser(). If the user is unknown, the transaction is used to retrieve it from the realm. As this runs in a separate
> thread it is blocked by the locked transaction.
>
> When the synchronized block is removed, the deadlock is gone, but you may experience other problems.
>
>
> Greetings Joerg.
>
> On 06/20/2012 01:24 PM, Xingxiao Lu wrote:
>> Hi, Eike
>> I use the HEAD of CDO GIT repository.
>> CDOServer: Add 'security' bundles to 'CDOServer' in Run Configuration.
>> Config the securityManager entiry in 'cdo-server.xml'. <securityManager
>> type="default" realmPath="/security"/>
>>
>> CDOClient: I use 'CDOExplorer'.
>>
>> Hope this information will give you help.
>>
>> Thank you for your professional reply.:)
>
|
|
|
Powered by
FUDForum. Page generated in 1.19835 seconds