private ICredentials InitCredentials(ClientSecurityConfig securityConfig, GroupConfig groupConfig) { var credentials = securityConfig.GetCredentials(); if (credentials == null) { var credentialsClassname = securityConfig.GetCredentialsClassName(); if (credentialsClassname != null) { try { var type = Type.GetType(credentialsClassname, true, false); if (type != null) { credentials = Activator.CreateInstance(type) as ICredentials; } } catch (Exception e) { throw ExceptionUtil.Rethrow(e); } } } if (credentials == null) { credentials = new UsernamePasswordCredentials(groupConfig.GetName(), groupConfig.GetPassword()); } return(credentials); }
public void Configure(GroupConfig groupConfig, IDictionary <string, string> properties) { if (!properties.TryGetValue("username", out _username)) { _username = groupConfig.GetName(); } if (!properties.TryGetValue("password", out _password)) { _password = groupConfig.GetPassword(); } }
public ICredentials NewCredentials() { string username, password; if (!properties.TryGetValue("username", out username)) { username = groupConfig.GetName(); } if (!properties.TryGetValue("password", out password)) { password = groupConfig.GetPassword(); } return(new UsernamePasswordCredentials(username, password)); }