internal override void Authenticate(UbTransport transport) { var requestHeaders = new Dictionary <string, string> { { "Authorization", $"UBIP {_login}" } }; var resp = transport.Get <UbIpAuthResponse>("auth", null, requestHeaders, sendCredentials: false); _login = resp.LogonName; }
internal override void Authenticate(UbTransport transport) { var queryStringParams = new Dictionary <string, string> { { "AUTHTYPE", "Negotiate" } }; var resp = transport.Get <NegotiateAuthResponse>("auth", queryStringParams, null, sendCredentials: true); _sessionWord = resp.SessionID; _sessionID = Crypto.Hexa8(resp.SessionID.Split('+')[0]); _sessionPasswordHash = resp.LogonName; }
internal override void Authenticate(UbTransport transport) { var firstQueryString = new Dictionary <string, string> { { "AUTHTYPE", "UB" }, { "userName", _login }, { "password", string.Empty } }; var firstResponse = transport.Get <UbHandShakeAuthResponse>("auth", firstQueryString, null, sendCredentials: false); var clientNonce = Crypto.Nsha256(DateTime.UtcNow.ToString("o").Substring(0, 16)); var serverNonce = firstResponse.Result; if (string.IsNullOrEmpty(serverNonce)) { throw new UbException("No server nonce."); } var secondQueryString = new Dictionary <string, string> { { "AUTHTYPE", "UB" }, { "userName", _login }, { "password", Crypto.Nsha256(_appName + serverNonce + clientNonce + _login + _passwordHash) }, { "clientNonce", clientNonce } }; if (firstResponse.ConnectionID != null) { secondQueryString.Add("connectionID", firstResponse.ConnectionID); } var secondResonse = transport.Get <UbAuthSecondResponse>("auth", secondQueryString, null, sendCredentials: false); _sessionID = Crypto.Hexa8(secondResonse.SessionID.Split('+')[0]); _secretWord = secondResonse.SessionID; }