public IConfigurationSession OpenConfigurationSession(IClientAuthenticationCredential credentials) { this.credentials = credentials; try { _session = new OutProcConfigurationSession(_serviceURI, _channel, credentials, _channelFormatter); _session.IsDatabaseSession = isDatabaseClient; _session.IsDistributorSession = isDistributorClient; _session.IsConfigurationSession = isConfigurationClient; ServerAuthenticationCredenital = _session.Authenticate(credentials); _session.Channel.IsAuthenticated = ServerAuthenticationCredenital.IsAuthenticated; _session.SessionType = _sessionType; if (ServerAuthenticationCredenital.IsAuthenticated) { DetermineSecondaryConfigurationServer(); _session.SessionId = ServerAuthenticationCredenital.SessionId; return(_session); } else { throw new Alachisoft.NosDB.Common.Security.SecurityException(ErrorCodes.Security.USER_NOT_REGISTERED, new string[1] { credentials.UserName }); } } catch (Exception ex) { _channel.Disconnect(); throw; } }
public IServerAuthenticationCredential Authenticate(IClientAuthenticationCredential clientCredentials) { SSPIServerAuthenticationCredential serverAuthenticationCredential = new SSPIServerAuthenticationCredential(); serverAuthenticationCredential.Token = new AuthToken(); serverAuthenticationCredential.Token.Status = Common.Security.SSPI.SecurityStatus.OK; return(serverAuthenticationCredential); }
public IServerAuthenticationCredential Authenticate(IClientAuthenticationCredential clientCredentials) { if (clientCredentials is SSPIClientAuthenticationCredential) { return(AuthenticateWindowsClient(clientCredentials as SSPIClientAuthenticationCredential)); } else { return(null); } }
public Common.Security.Server.IServerAuthenticationCredential AuthenticateClient(IClientAuthenticationCredential credentials) { throw new NotImplementedException(); }
public IConfigurationSession OpenConfigurationSession(IClientAuthenticationCredential credentials) { return(new InProcConfigurationSession(_server.OpenConfigurationSession(credentials))); }
public static IConfigurationSession Connect(string[] configServers, int configServerPort, string cluster, out IConfigurationServer remote, IChannelFormatter channelFormatter, IClientAuthenticationCredential clientAuthenticationCredential, bool remoteRouter = false) { Exception exception = null; DatabaseRPCService rpc = null; remote = null; IConfigurationSession configurationSession = null; int csPort = configServerPort; Boolean found = false; foreach (String current in configServers) { if (found) { break; } int retries = 3; while (retries > 0) { try { if (configurationSession != null) { configurationSession.Close(); configurationSession = null; } rpc = new DatabaseRPCService(current, csPort); //if (remote == null) { remote = rpc.GetConfigurationServer(new TimeSpan(0, 0, 90), SessionTypes.Client, channelFormatter); } if (remoteRouter) { remote.MarkDistributorSession(); } configurationSession = remote.OpenConfigurationSession(clientAuthenticationCredential); if (configurationSession != null) { List <Alachisoft.NosDB.Common.Net.Address> csServers = configurationSession.GetConfServers(cluster); if (csServers == null || csServers.Count < 1) { throw new DatabaseException(Common.ErrorHandling.ErrorCodes.Distributor.CLUSTER_INFO_UNAVAILABLE, new[] { cluster }); } foreach (Alachisoft.NosDB.Common.Net.Address add in csServers) { if (add.ip.Equals(current)) { found = true; } } if (!found) { configurationSession.Close(); configurationSession = null; foreach (Alachisoft.NosDB.Common.Net.Address cur in csServers) { try { rpc = new DatabaseRPCService(cur.ip, csPort); remote = rpc.GetConfigurationServer(new TimeSpan(0, 0, 90), SessionTypes.Client, channelFormatter); if (remoteRouter) { remote.MarkDistributorSession(); } configurationSession = remote.OpenConfigurationSession(clientAuthenticationCredential); found = true; } catch (Exception ex) { exception = ex; } } } } if (found) { break; } } catch (Alachisoft.NosDB.Common.Exceptions.TimeoutException) { if (configurationSession != null) { configurationSession.Close(); configurationSession = null; } exception = new DistributorException(ErrorCodes.Distributor.CONFIGURATION_SERVER_NOTRESPONDING); retries--; if (retries == 0) { break; } } catch (Exception e) { if (configurationSession != null) { configurationSession.Close(); configurationSession = null; } exception = e; retries--; if (retries == 0) { break; } } } } if (configurationSession != null) { return(configurationSession); } else if (exception != null) { throw exception; } return(null); }
public IServerAuthenticationCredential OpenConfigurationSession(IClientAuthenticationCredential clientCredentials) { return(AuthenticateWindowsClient(clientCredentials as SSPIClientAuthenticationCredential)); }
public IServerAuthenticationCredential AuthenticateClient(IClientAuthenticationCredential credentials) { return(_session.Authenticate(credentials)); }
public IServerAuthenticationCredential OpenConfigurationSession(string cluster, IClientAuthenticationCredential clientCredentials) { SSPIServerAuthenticationCredential serverAuthenticationCredential = new SSPIServerAuthenticationCredential(); serverAuthenticationCredential.Token = new AuthToken(); serverAuthenticationCredential.Token.Status = Common.Security.SSPI.SecurityStatus.OK; return(serverAuthenticationCredential); }