Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » CDO and Negotiator
CDO and Negotiator [message #421775] Wed, 13 August 2008 12:52 Go to next message
Eclipse UserFriend
Originally posted by: fdo.scodi.ch

Hello

I'm trying to use the CDO Negotiator and it does work.

So my problem now, the exception that is thrown on the client side, is not
really an exception I can use.
If I change my PasswordCredentials to "user2", I get the following:
org.eclipse.net4j.connector.ConnectorException: Connector not connected
....

On the server side I get a much better exception:
java.lang.SecurityException: No such user: user2
....

This is the exception I would like to have on the client side.

Here is my server configuration:

<acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
<negotiator type="challenge" description="c:/temp/users.db"/>
</acceptor>

This here is my client:

IPasswordCredentialsProvider credentialsProvider = new
PasswordCredentialsProvider(new
PasswordCredentials("user","pw".toCharArray()));

ResponseNegotiator responseNegotiator = new ResponseNegotiator();
responseNegotiator.setCredentialsProvider(credentialsProvide r);
responseNegotiator.activate();

Net4jTransportInjector.clientNegotiator = responseNegotiator;

IManagedContainer container = ContainerUtil.createContainer(); // Create
a wiring container
Net4jUtil.prepareContainer(container); // Prepare the Net4j kernel
TCPUtil.prepareContainer(container); // Prepare the JVM transport
CDOUtil.prepareContainer(container, false); // Prepare the CDO client

IConnector connector = TCPUtil.getConnector(container, URL); // Open a
TCP connection
CDOSessionConfiguration configuration =
CDOUtil.createSessionConfiguration();
configuration.setConnector(connector);
configuration.setRepositoryName(REPOSITORY);
configuration.setLegacySupportEnabled(false);


CDOSession session = configuration.openSession();
session.getPackageRegistry().putEPackage(DataPackage.eINSTAN CE);


So I don't know if this is the correct way to do this on the client side,
if not correct me. Maybe something is initialized the wrong way...

Is there some documentation on Negotiators?

thanks for help
Re: CDO and Negotiator [message #421785 is a reply to message #421775] Wed, 13 August 2008 14:14 Go to previous messageGo to next message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
Hi Flavio,

I'm not absolutely sure but IIRC the challenge negotiator by design does
not answer back falied authentication. Generally I believe that a client
must at least not be able to distinguish invalid user name from password
mismatch. But if you feel that the connector should throw a
SecurityException please file an enhancement request so that I can look
at this.

Cheers
/Eike



Flavio Donzé schrieb:
> Hello
>
> I'm trying to use the CDO Negotiator and it does work.
>
> So my problem now, the exception that is thrown on the client side, is
> not really an exception I can use. If I change my PasswordCredentials
> to "user2", I get the following:
> org.eclipse.net4j.connector.ConnectorException: Connector not connected
> ....
>
> On the server side I get a much better exception:
> java.lang.SecurityException: No such user: user2
> ....
>
> This is the exception I would like to have on the client side.
>
> Here is my server configuration:
>
> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
> <negotiator type="challenge" description="c:/temp/users.db"/>
> </acceptor>
>
> This here is my client:
>
> IPasswordCredentialsProvider credentialsProvider = new
> PasswordCredentialsProvider(new
> PasswordCredentials("user","pw".toCharArray()));
>
> ResponseNegotiator responseNegotiator = new ResponseNegotiator();
> responseNegotiator.setCredentialsProvider(credentialsProvide r);
> responseNegotiator.activate();
> Net4jTransportInjector.clientNegotiator =
> responseNegotiator;
>
> IManagedContainer container = ContainerUtil.createContainer();
> // Create a wiring container
> Net4jUtil.prepareContainer(container); // Prepare the Net4j
> kernel
> TCPUtil.prepareContainer(container); // Prepare the JVM transport
> CDOUtil.prepareContainer(container, false); // Prepare the CDO
> client
>
> IConnector connector = TCPUtil.getConnector(container, URL);
> // Open a TCP connection
> CDOSessionConfiguration configuration =
> CDOUtil.createSessionConfiguration();
> configuration.setConnector(connector);
> configuration.setRepositoryName(REPOSITORY);
> configuration.setLegacySupportEnabled(false);
> CDOSession session = configuration.openSession();
> session.getPackageRegistry().putEPackage(DataPackage.eINSTAN CE);
>
>
> So I don't know if this is the correct way to do this on the client
> side, if not correct me. Maybe something is initialized the wrong way...
>
> Is there some documentation on Negotiators?
>
> thanks for help
>
>


Re: CDO and Negotiator [message #421801 is a reply to message #421785] Wed, 13 August 2008 18:41 Go to previous message
Eike Stepper is currently offline Eike StepperFriend
Messages: 6682
Registered: July 2009
Senior Member
FYI:

244029: Challenge Negotiator should throw an SecurityException if login
failed
https://bugs.eclipse.org/bugs/show_bug.cgi?id=244029



Eike Stepper schrieb:
> Hi Flavio,
>
> I'm not absolutely sure but IIRC the challenge negotiator by design
> does not answer back falied authentication. Generally I believe that a
> client must at least not be able to distinguish invalid user name from
> password mismatch. But if you feel that the connector should throw a
> SecurityException please file an enhancement request so that I can
> look at this.
>
> Cheers
> /Eike
>
>
>
> Flavio Donzé schrieb:
>> Hello
>>
>> I'm trying to use the CDO Negotiator and it does work.
>>
>> So my problem now, the exception that is thrown on the client side,
>> is not really an exception I can use. If I change my
>> PasswordCredentials to "user2", I get the following:
>> org.eclipse.net4j.connector.ConnectorException: Connector not connected
>> ....
>>
>> On the server side I get a much better exception:
>> java.lang.SecurityException: No such user: user2
>> ....
>>
>> This is the exception I would like to have on the client side.
>>
>> Here is my server configuration:
>>
>> <acceptor type="tcp" listenAddr="0.0.0.0" port="2036">
>> <negotiator type="challenge" description="c:/temp/users.db"/>
>> </acceptor>
>>
>> This here is my client:
>>
>> IPasswordCredentialsProvider credentialsProvider = new
>> PasswordCredentialsProvider(new
>> PasswordCredentials("user","pw".toCharArray()));
>>
>> ResponseNegotiator responseNegotiator = new
>> ResponseNegotiator();
>> responseNegotiator.setCredentialsProvider(credentialsProvide r);
>> responseNegotiator.activate();
>> Net4jTransportInjector.clientNegotiator =
>> responseNegotiator;
>>
>> IManagedContainer container =
>> ContainerUtil.createContainer(); // Create a wiring container
>> Net4jUtil.prepareContainer(container); // Prepare the Net4j
>> kernel
>> TCPUtil.prepareContainer(container); // Prepare the JVM
>> transport
>> CDOUtil.prepareContainer(container, false); // Prepare the
>> CDO client
>>
>> IConnector connector = TCPUtil.getConnector(container, URL);
>> // Open a TCP connection
>> CDOSessionConfiguration configuration =
>> CDOUtil.createSessionConfiguration();
>> configuration.setConnector(connector);
>> configuration.setRepositoryName(REPOSITORY);
>> configuration.setLegacySupportEnabled(false);
>> CDOSession session =
>> configuration.openSession();
>> session.getPackageRegistry().putEPackage(DataPackage.eINSTAN CE);
>>
>>
>> So I don't know if this is the correct way to do this on the client
>> side, if not correct me. Maybe something is initialized the wrong way...
>>
>> Is there some documentation on Negotiators?
>>
>> thanks for help
>>
>>


Previous Topic:ResourceEntityHandler
Next Topic:Undo/Redo without using item providers
Goto Forum:
  


Current Time: Fri Apr 19 19:48:53 GMT 2024

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

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

Back to the top