diff options
author | Eike Stepper | 2012-12-28 16:53:06 +0000 |
---|---|---|
committer | Eike Stepper | 2012-12-28 16:53:06 +0000 |
commit | 7fdb35be120e74cc8f40b9bf7fad41370b5bbdbf (patch) | |
tree | bce74cb79bc9f78b80ab4e2a1ec8f49d8a9a57ed /plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal | |
parent | 994acc27bc77822d4066ed49a96b651be26865e1 (diff) | |
download | cdo-7fdb35be120e74cc8f40b9bf7fad41370b5bbdbf.tar.gz cdo-7fdb35be120e74cc8f40b9bf7fad41370b5bbdbf.tar.xz cdo-7fdb35be120e74cc8f40b9bf7fad41370b5bbdbf.zip |
[299275] Flexible Approach for an Authentication Mechanism drops/I20121228-1208
https://bugs.eclipse.org/bugs/show_bug.cgi?id=299275
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal')
2 files changed, 21 insertions, 13 deletions
diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AuthenticationRequest.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AuthenticationRequest.java index 163350a3a9..d5867e2ff7 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AuthenticationRequest.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/AuthenticationRequest.java @@ -12,42 +12,42 @@ package org.eclipse.emf.cdo.server.internal.net4j.protocol; import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.common.util.NotAuthenticatedException; -import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult; import org.eclipse.net4j.signal.RemoteException; import org.eclipse.net4j.signal.RequestWithMonitoring; import org.eclipse.net4j.util.io.ExtendedDataInputStream; import org.eclipse.net4j.util.io.ExtendedDataOutputStream; import org.eclipse.net4j.util.om.monitor.OMMonitor; +import org.eclipse.net4j.util.security.DiffieHellman.Client.Response; +import org.eclipse.net4j.util.security.DiffieHellman.Server.Challenge; /** * @author Eike Stepper */ -public class AuthenticationRequest extends RequestWithMonitoring<CDOAuthenticationResult> +public class AuthenticationRequest extends RequestWithMonitoring<Response> { - private byte[] randomToken; + private Challenge challenge; - public AuthenticationRequest(CDOServerProtocol protocol, byte[] randomToken) + public AuthenticationRequest(CDOServerProtocol protocol, Challenge challenge) { super(protocol, CDOProtocolConstants.SIGNAL_AUTHENTICATION); - this.randomToken = randomToken; + this.challenge = challenge; } @Override protected void requesting(ExtendedDataOutputStream out, OMMonitor monitor) throws Exception { - out.writeByteArray(randomToken); + challenge.write(out); } @Override - protected CDOAuthenticationResult confirming(ExtendedDataInputStream in, OMMonitor monitor) throws Exception + protected Response confirming(ExtendedDataInputStream in, OMMonitor monitor) throws Exception { try { - boolean authenticated = in.readBoolean(); - if (authenticated) + if (in.readBoolean()) { - return new CDOAuthenticationResult(in); + return new Response(in); } } catch (RemoteException ex) diff --git a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java index dcc2ffd447..b2414e325f 100644 --- a/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java +++ b/plugins/org.eclipse.emf.cdo.server.net4j/src/org/eclipse/emf/cdo/server/internal/net4j/protocol/CDOServerProtocol.java @@ -22,7 +22,6 @@ import org.eclipse.emf.cdo.common.protocol.CDOProtocolConstants; import org.eclipse.emf.cdo.server.IRepositoryProvider; import org.eclipse.emf.cdo.server.internal.net4j.bundle.OM; import org.eclipse.emf.cdo.session.remote.CDORemoteSessionMessage; -import org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult; import org.eclipse.emf.cdo.spi.common.branch.InternalCDOBranch; import org.eclipse.emf.cdo.spi.server.ISessionProtocol; import org.eclipse.emf.cdo.spi.server.InternalSession; @@ -32,6 +31,8 @@ import org.eclipse.net4j.signal.SignalReactor; import org.eclipse.net4j.util.io.StringCompressor; import org.eclipse.net4j.util.io.StringIO; import org.eclipse.net4j.util.lifecycle.LifecycleUtil; +import org.eclipse.net4j.util.security.DiffieHellman.Client.Response; +import org.eclipse.net4j.util.security.DiffieHellman.Server.Challenge; /** * @author Eike Stepper @@ -83,9 +84,16 @@ public class CDOServerProtocol extends SignalProtocol<InternalSession> implement this.negotiationTimeout = negotiationTimeout; } - public CDOAuthenticationResult sendAuthenticationChallenge(byte[] randomToken) throws Exception + @Deprecated + public org.eclipse.emf.cdo.spi.common.CDOAuthenticationResult sendAuthenticationChallenge(byte[] randomToken) + throws Exception + { + throw new UnsupportedOperationException(); + } + + public Response sendAuthenticationChallenge(Challenge challenge) throws Exception { - return new AuthenticationRequest(this, randomToken).send(negotiationTimeout); + return new AuthenticationRequest(this, challenge).send(negotiationTimeout); } public void sendRepositoryTypeNotification(CDOCommonRepository.Type oldType, CDOCommonRepository.Type newType) |