public static Exception AuthenticateUser(string username, string password, bool isProduction) { try { using (NAASClient client = new NAASClient(isProduction)) { client.Timeout = 30000; CentralAuth req = new CentralAuth(); req.authenticationMethod = "password"; req.clientIp = string.Empty; req.credential = password; req.domain = DomainTypeCode.@default; req.resourceURI = string.Empty; req.userId = username; CentralAuthResponse resp = client.CentralAuth(req); string token = resp.@return; if (string.IsNullOrEmpty(token)) { throw new ArgumentException("NAAS returned an empty authentication token"); } return(null); } } catch (Exception e) { return(e); } }
public CentralAuthResponse CentralAuth([System.Xml.Serialization.XmlElementAttribute("CentralAuth", Namespace = "http://www.exchangenetwork.net/schema/auth/3")] CentralAuth CentralAuth1) { object[] results = this.Invoke("CentralAuth", new object[] { CentralAuth1 }); return((CentralAuthResponse)(results[0])); }
/// <remarks/> public void CentralAuthAsync(CentralAuth CentralAuth1, object userState) { if ((this.CentralAuthOperationCompleted == null)) { this.CentralAuthOperationCompleted = new System.Threading.SendOrPostCallback(this.OnCentralAuthOperationCompleted); } this.InvokeAsync("CentralAuth", new object[] { CentralAuth1 }, this.CentralAuthOperationCompleted, userState); }
/// <summary> /// Authenticate user NAAS credentials /// </summary> /// <param name="username">NAAS Username</param> /// <param name="password">NAAS Password</param> /// <param name="clientHostIp">IP address of the orginal requestor</param> /// <param name="authenticationMethod">one of the authentication methods supported by naas [password]</param> /// <returns></returns> protected string AuthenticateUser( string username, string password, string clientHostIP, string authenticationMethod, Windsor.Commons.NAASClient.NAASClient naasClient) { try { NAAS_CLIENT.CentralAuth req = new NAAS_CLIENT.CentralAuth(); req.authenticationMethod = authenticationMethod; req.clientIp = clientHostIP; req.credential = password; //Once we see this being used we can refactor. For now just use the default. req.domain = DEFAULT_DOMAIN_TYPE; req.resourceURI = string.Empty; req.userId = username; NAAS_CLIENT.CentralAuthResponse resp = naasClient.CentralAuth(req); string token = resp.@return; if (string.IsNullOrEmpty(token)) { throw new ApplicationException("NAAS Returned an empty token"); } return(token); } catch (SoapException soapException) { #if DEBUG if (BypassNaasAuthenticateFailures) { return(_bypassNaasUserName); } #endif // DEBUG LOG.Error("NAAS authentication error", soapException); throw new InvalidCredentialException("NAAS authentication error: " + soapException.Message); } catch (Exception naasException) { #if DEBUG if (BypassNaasAuthenticateFailures) { return(_bypassNaasUserName); } #endif // DEBUG LOG.Error("NAAS connection error", naasException); throw new AuthenticationException("NAAS connection error: " + naasException.Message); } }
/// <remarks/> public void CentralAuthAsync(CentralAuth CentralAuth1) { this.CentralAuthAsync(CentralAuth1, null); }
/// <remarks/> public System.IAsyncResult BeginCentralAuth(CentralAuth CentralAuth1, System.AsyncCallback callback, object asyncState) { return(this.BeginInvoke("CentralAuth", new object[] { CentralAuth1 }, callback, asyncState)); }