// Handle the connection to the server
    protected void btnConnect_Click(object sender, EventArgs e)
    {
        string Port = Request.ServerVariables["SERVER_PORT"];
        string Protocol = Request.ServerVariables["SERVER_PORT_SECURE"];
        string basePath = string.Empty;

        if (Port == null || Port == "80" || Port == "443")
            Port = "";
        else
            Port = String.Format(":{0}", Port);

        if (Protocol == null || Protocol == "0")
            Protocol = "http://";
        else
            Protocol = "https://";

        basePath = String.Format("{0}{1}{2}{3}/Default.aspx", Protocol, Request.ServerVariables["SERVER_NAME"], Port, Request.ApplicationPath);

        IntellisyncServer server = new IntellisyncServer(basePath);
        UserCredentials credentials = new UserCredentials(userId.Text, password.Text, "");

        if (server.TestAuthenticate(userId.Text, credentials.Password, string.Empty))
        {
            testMessage.Text =  GetResource("SuccessMessage");
        } else
        {
            testMessage.Text = GetResource("FailMessage");
        }
    }
示例#2
0
        private static UserCredentials PromptForUserCredentials(List<User> users)
        {
            var userCredentials = new UserCredentials();
            string name = PromptForUserName();

            while (!userCredentials.AreValid && !string.IsNullOrEmpty(name))
            {
                if (!UserNameIsValid(users, name))
                {
                    DisplayInvalidUserNameMessage();
                    name = PromptForUserName();
                }
                else
                {
                    string password = PromptForUserPassword();
                    userCredentials = new UserCredentials(name, password);

                    if (!PasswordIsValid(users, userCredentials))
                    {
                        DisplayInvalidPasswordMessage();
                        name = PromptForUserName();
                    }
                    else
                    {
                        userCredentials.AreValid = true;
                    }
                }
            }
            return userCredentials;
        }
示例#3
0
 public TestResponder()
 {
     Credentials = new UserCredentials
     {
         Username = "******"
     };
 }
        /// <summary>
        /// Create a new Aneka cloud/master user for a specific cloud
        /// </summary>
        /// <param name="cloudUserAccount">The new  account information to add</param>
        /// <param name="cloudID">The cloud ID to add this user to</param>
        public void createNewUser(CloudUserAccount cloudUserAccount, int cloudID)
        {
            // Check to see if a non-empty username was specified
            if (string.IsNullOrEmpty(cloudUserAccount.Username) == true)
            {
                throw new Exception("Invalid User Name: The user name cannot be empty or contain only white-spaces");
            }

            // Validate password
            if (cloudUserAccount.Password.Length < 6)
            {
                throw new Exception("Invalid Password: The password must be at least six characters long");
            }

            List<string> groups = new List<string>();

            // [DK] NOTE: Do we need to have a selection list of
            //            groups in this form?

            UserCredentials credentials = new UserCredentials(cloudUserAccount.Username, cloudUserAccount.Password, cloudUserAccount.Username, cloudUserAccount.useThisAccountForReporting ? "This account will be used for reporting" : "Normal account", groups);
            securityManager.CreateUser(credentials);

            CloudUserAccount CloudUserAccountfromDB = db.CloudUserAccounts.Find(cloudUserAccount.CloudUserAccountId);
            Cloud cloudFromDB = db.Clouds.Find(cloudID);
            CloudUserAccountfromDB.Clouds.Add(cloudFromDB);
            db.SaveChanges();
        }
 public void Setup()
 {
     var creds = new UserCredentials("foo", "auth", "http://foo.com");
     _client = new FakeClient();
     _conn = new CF_Connection(creds, _client);
     _conn.Authenticate();
 }
        protected static UserCredentials getCredentails()
        {
            UserCredentials userCredentials = new UserCredentials();
            userCredentials.userid = Settings.IndoorTriathlonServiceUsername; // "VARegistration";
            userCredentials.password = Settings.IndoorTriathlonServicePassword; // "cr34m t34";

            return userCredentials;
        }
示例#7
0
 /// <summary>
 /// Creates SJMPClient
 /// </summary>
 /// <param name="url">URL to connect to.</param>
 /// <param name="auth">Auth credentials. Null if not needed.</param>
 public SjmpClient(string url, IClientCredentials auth = null) 
 {
     this.m_url = url;
     if (auth != null)
     {
         this.m_auth = new UserCredentials(auth);
     };
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="GetAuthentication"/> class.
 /// </summary>
 /// <param name="userCreds">the UserCredentials instace to use when attempting authentication</param>
 /// <exception cref="System.ArgumentNullException">Thrown when any of the reference arguments are null</exception>
 public GetAuthentication(UserCredentials userCreds)
 {
     if (userCreds == null)
     {
         throw new ArgumentNullException();
     }
     _userCredentials = userCreds;
 }
        public void SetDefaultUserCredentials_ShouldStoreSpecifiedCredentials()
        {
            var expectedCredentials = new UserCredentials("a", "b");
            var builder = new ConnectionSettingsBuilder();
            builder.SetDefaultUserCredentials(expectedCredentials);

            ((ConnectionSettings)builder).DefaultUserCredentials.Should().Be(expectedCredentials);
        }
        /*[HttpPost]
        [Route("user/token")]
        public string CreateToken(UserCredentials credentials)
        {
            if (credentials?.Email?.IsEmpty() != true || credentials.Password?.IsEmpty() != true)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            if (context.Users.Any(u => u.Email == credentials.Email && u.Hash == CreateHash(credentials.Password, u.Salt)))
            {
                return CreateHash(credentials.Email);
            }

            throw new HttpResponseException(HttpStatusCode.Unauthorized);
        }*/
        public void CreateAccount(UserCredentials credentials)
        {
            if (credentials?.Email?.IsEmpty() != true || credentials.Password?.IsEmpty() != true)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest);
            }

            throw new HttpResponseException(HttpStatusCode.Created);
        }
 public static CollectionAgent GetAgent(this Specimen s, UserCredentials profile)
 {
     return new CollectionAgent()
     {
         CollectionSpecimenID = s.CollectionSpecimenID,
         CollectorsAgentURI = profile.AgentURI,
         CollectorsName = profile.AgentName
     };
 }
示例#12
0
        public static UserCredentials Credentialize(ResponseChannel channel)
        {
            UserCredentials creds = new UserCredentials();

            creds.Username = channel.ToName;
            creds.ServiceName = channel.Connection.Alias;

            return creds;
        }
示例#13
0
        public static UserCredentials Credentialize(string strUser, string strServ)
        {
            UserCredentials creds = new UserCredentials();

            creds.Username = strUser;
            creds.ServiceName = strServ;

            return creds;
        }
 public void TestAuthenticateFail()
 {
     var creds = new UserCredentials("foo", "fail", "http://foo.com");
     Client client = new FakeClient();
     Connection conn = new CF_Connection(creds, client);
     Assert.AreEqual(conn.UserCreds.UserName, "foo");
     Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com/");
     Assert.AreEqual(conn.UserCreds.ApiKey, "fail");
     Assert.Throws<AuthenticationFailedException>(conn.Authenticate);
 }
        private void btnSignIn_Click(object sender, RoutedEventArgs e)
        {
            UserCredentials credentials = new UserCredentials();
            credentials.Username = txtAccountUsername.Text;
            credentials.Password = txtAccountPassword.Password;

            Thread thrd = new Thread(new ParameterizedThreadStart(SignInThread));
            thrd.SetApartmentState(ApartmentState.STA);
            thrd.Start(credentials);
        }
示例#16
0
		/// <summary>
		/// Returns an encrypted token for use with UserCredentials
		/// </summary>
		/// <param name="theUserCredentials">UserCredentials object</param>
		/// <param name="theLifetimeInMinutes">Lifetime that token is valid</param>
		/// <returns>Encrypted token</returns>
		public string GetToken(UserCredentials theUserCredentials, int theLifetimeInMinutes)
		{
			var aTemporaryUserCredentials = new TemporaryUserCredentials(theUserCredentials, theLifetimeInMinutes);

			var aJsonObject = JsonConvert.SerializeObject(aTemporaryUserCredentials);

			var aEncryptedJsonObject = StringCipher.Encrypt(aJsonObject, _phrase);

			return CreateBearerToken(aEncryptedJsonObject);
		}
示例#17
0
        public ActionResult LogOn(UserCredentials credentials, String returnUrl)
        {
            Boolean b = FormsAuthentication.Authenticate(credentials.UserName, credentials.Password);
            if (!b) {
                ModelState.AddModelError("AuthenticationFailure", "Invalid username and password");
                return View(credentials);
            }

            FormsAuthentication.SetAuthCookie(credentials.UserName, false);
            return Redirect(returnUrl ?? "/Admin");
        }
 public static IdentificationUnitGeoAnalysis GetGeoAnalysis(this IdentificationUnit iu, UserCredentials profile)
 {
     return new IdentificationUnitGeoAnalysis()
     {
         AnalysisDate = iu.AnalysisDate,
         IdentificationUnitID = iu.CollectionUnitID,
         CollectionSpecimenID = iu.CollectionSpecimenID,
         ResponsibleName = profile.AgentName,
         ResponsibleAgentURI = profile.AgentURI,
     };
 }
 /// <summary>
 /// GetAuthentication constructor
 /// </summary>
 /// <param name="userCredentials">the UserCredentials instace to use when attempting authentication</param>
 /// <exception cref="System.ArgumentNullException">Thrown when any of the reference arguments are null</exception>
 public GetAuthentication(UserCredentials userCredentials)
 {
     if (userCredentials == null) throw new ArgumentNullException();
     Uri = string.IsNullOrEmpty(userCredentials.AccountName)
         ? userCredentials.AuthUrl
         : new Uri(userCredentials.AuthUrl + "/"
             + userCredentials.Cloudversion.Encode() + "/"
             + userCredentials.AccountName.Encode() + "/auth");
     Method = "GET";
     Headers.Add(Constants.X_AUTH_USER, userCredentials.Username.Encode());
     Headers.Add(Constants.X_AUTH_KEY, userCredentials.Api_access_key.Encode());
 }
示例#20
0
 public Person(string firstName, string middleName, string lastName, string address, string phoneNumber, string email, int postalCode, UserCredentials userCredentials)
 {
     id = 0;
     this.firstName = firstName;
     this.middleName = middleName;
     this.lastName = lastName;
     this.address = address;
     this.phoneNumber = phoneNumber;
     this.email = email;
     this.postalCode = postalCode;
     this.userCredentials = userCredentials;
 }
 public void TestAuthenticate()
 {
     var creds = new UserCredentials("foo", "auth", "http://foo.com");
     Client client = new FakeClient();
     Connection conn = new CF_Connection(creds, client);
     Assert.AreEqual(conn.UserCreds.UserName, "foo");
     Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com");
     Assert.AreEqual(conn.UserCreds.ApiKey, "auth");
     conn.Authenticate();
     Assert.AreEqual(conn.UserCreds.CdnMangementUrl.ToString(), "https://foo.com/");
     Assert.AreEqual(conn.UserCreds.StorageUrl.ToString(), "https://foo.com/");
     Assert.AreEqual(conn.UserCreds.AuthToken, "foo");
 }
        public void TestHasMatchingPassword()
        {
            string properLengthInput = new string('a', UserCredentials.MINIMAL_PASSWORD_LENGTH);
            string matchingPassword = new string('a', UserCredentials.MINIMAL_PASSWORD_LENGTH);
            string notMatchingPassword = new string('b', UserCredentials.MINIMAL_PASSWORD_LENGTH);
            UserCredentials userCredentials = new UserCredentials(properLengthInput, properLengthInput);
            bool matchingPasswordResult;
            bool notMatchingPasswordResult;

            matchingPasswordResult = userCredentials.HasMatchingPassword(matchingPassword);
            notMatchingPasswordResult = userCredentials.HasMatchingPassword(notMatchingPassword);

            Assert.IsTrue(matchingPasswordResult, "Should be a match.");
            Assert.IsFalse(notMatchingPasswordResult, "Should not be a match.");
        }
        /// <summary>
        /// Extracts the geo location information stored in the client-side <see cref="Event"/> Object
        /// And converts it to its <see cref="CollectionEventLocalisation"/> representation.
        /// </summary>
        /// <param name="ev">The client-side Event object possibly containing location information.</param>
        /// <param name="profile">The Profile of the User responsible for creating this object.</param>
        /// <returns>Between 0 and 2 <see cref="CollectionEventLocalisation"/> objects depending on the amount of information in the Input object.</returns>
        public static IEnumerable<CollectionEventLocalisation> GetLocalisations(this Event ev, UserCredentials profile)
        {
            IList<CollectionEventLocalisation> localisations = new List<CollectionEventLocalisation>();
            if (ev.Altitude.HasValue && !double.IsNaN(ev.Altitude.Value))
            {
                CollectionEventLocalisation altitude = new CollectionEventLocalisation();
                altitude.AverageAltitudeCache = ev.Altitude;
                altitude.AverageLatitudeCache = ev.Latitude;
                altitude.AverageLongitudeCache = ev.Longitude;
                altitude.CollectionEventID = ev.CollectionEventID;
                altitude.DeterminationDate = ev.CollectionDate;
                altitude.LocalisationSystemID = ALTITUDE_LOC_SYS_ID;
                altitude.Location1 = ev.Altitude.ToString();
                altitude.ResponsibleAgentURI = profile.AgentURI;
                altitude.ResponsibleName = profile.AgentName;
                altitude.RecordingMethod = "Generated via DiversityMobile";
                localisations.Add(altitude);
            }

            if (ev.Latitude.HasValue && !double.IsNaN(ev.Latitude.Value)
                && ev.Longitude.HasValue && !double.IsNaN(ev.Longitude.Value))
            {
                CollectionEventLocalisation wgs84 = new CollectionEventLocalisation();
                if (ev.Altitude != null && double.IsNaN((double)ev.Altitude) == false)
                {
                    wgs84.AverageAltitudeCache = ev.Altitude;
                }
                else
                {
                    wgs84.AverageAltitudeCache = null;
                }

                wgs84.AverageLatitudeCache = ev.Latitude;
                wgs84.AverageLongitudeCache = ev.Longitude;
                wgs84.CollectionEventID = ev.CollectionEventID;
                wgs84.DeterminationDate = ev.CollectionDate;
                wgs84.LocalisationSystemID = WGS84_LOC_SYS_ID;
                wgs84.Location1 = ev.Longitude.ToString();
                wgs84.Location2 = ev.Latitude.ToString();
                wgs84.ResponsibleAgentURI = profile.AgentURI;
                wgs84.ResponsibleName = profile.AgentName;
                wgs84.RecordingMethod = "Generated via DiversityMobile";
                localisations.Add(wgs84);
            }

            return localisations;
        }
 public static Identification GetIdentification(this IdentificationUnit iu, UserCredentials profile)
 {
     return new Identification()
     {
         CollectionSpecimenID = iu.CollectionSpecimenID,
         IdentificationUnitID = iu.CollectionUnitID,
         IdentificationSequence = 1,
         IdentificationDay = (byte?)iu.AnalysisDate.Day,
         IdentificationMonth = (byte?)iu.AnalysisDate.Month,
         IdentificationYear = (short?)iu.AnalysisDate.Year,
         IdentificationDateCategory = "actual",
         TaxonomicName = iu.LastIdentificationCache,
         NameURI = iu.IdentificationUri,
         IdentificationCategory = "determination",
         ResponsibleName = profile.AgentName,
         ResponsibleAgentURI = profile.AgentURI,
         IdentificationQualifier = iu.Qualification
     };
 }
 public void TestConnectionCheckMembers()
 {
     var creds = new UserCredentials("foo", "auth", "http://foo.com");
     Client client = new FakeClient();
     Connection conn = new CF_Connection(creds, client);
     Assert.AreEqual(conn.UserCreds.UserName, "foo");
     Assert.AreEqual(conn.UserCreds.AuthUrl, "http://foo.com/");
     Assert.AreEqual(conn.UserCreds.ApiKey, "auth");
     conn.Authenticate();
     Assert.AreEqual(conn.UserCreds.CdnMangementUrl.ToString(), "https://foo.com/");
     Assert.AreEqual(conn.UserCreds.StorageUrl.ToString(), "https://foo.com/");
     Assert.AreEqual(conn.UserCreds.AuthToken, "foo");
     Assert.True(conn.HasCDN);
     conn.UserCreds.CdnMangementUrl = null;
     Assert.IsFalse(conn.HasCDN);
     conn.UserAgent = "foo";
     Assert.AreEqual(conn.UserAgent, "foo");
     conn.Timeout = 1;
     Assert.AreEqual(conn.Timeout, 1);
     conn.Retries = 1;
     Assert.AreEqual(conn.Retries, 1);
 }
        public void TestUserCredentialsConstructor()
        {
            string properLengthInput = new string('a', UserCredentials.MINIMAL_PASSWORD_LENGTH);
            string improperLenghtInput = "a";
            int expectedMessageCount = 4;
            UserCredentials.MessengerSent += HelperOnMessangerSent;
            UserCredentials userCredentialsImpImp = new UserCredentials(improperLenghtInput, improperLenghtInput);
            UserCredentials userCredentialsImpProp = new UserCredentials(improperLenghtInput, properLengthInput);
            UserCredentials userCredentialsPropImp = new UserCredentials(properLengthInput, improperLenghtInput);
            UserCredentials userCredentialsPropProp = new UserCredentials(properLengthInput, properLengthInput);
            UserCredentials.MessengerSent -= HelperOnMessangerSent;

            Assert.AreEqual(userCredentialsImpImp.GetUsername(), String.Empty);
            Assert.AreEqual(userCredentialsImpImp.GetPassword(), String.Empty);
            Assert.AreEqual(userCredentialsImpProp.GetUsername(), String.Empty);
            Assert.AreEqual(userCredentialsImpProp.GetPassword(), properLengthInput);
            Assert.AreEqual(userCredentialsPropImp.GetUsername(), properLengthInput);
            Assert.AreEqual(userCredentialsPropImp.GetPassword(), String.Empty);
            Assert.AreEqual(userCredentialsPropProp.GetUsername(), properLengthInput);
            Assert.AreEqual(userCredentialsPropProp.GetPassword(), properLengthInput);
            Assert.AreEqual(expectedMessageCount, messageCount, "Message count is not expected.");
        }
 public void SetUp()
 {
     _credentials = new UserCredentials("admin", "changeit");
     _sut         = new FixedStreamUserCredentialsResolver(_credentials);
 }
示例#28
0
        public static void Main(string[] args)
        {
            try
            {
                string fileName          = null;
                string tsa               = null;
                string hash              = null;
                string policy            = null;
                string nonce             = null;
                bool   cert              = false;
                string outFile           = null;
                string sslClientCertFile = null;
                string sslClientCertPass = null;
                string httpAuthLogin     = null;
                string httpAuthPass      = null;
                bool   isAsics           = false;

                if (args == null)
                {
                    return;
                }

                int i = 0;
                if (0 >= args.Length)
                {
                    ExitWithHelp(string.Empty);
                }

                while (i < args.Length)
                {
                    switch (args[i])
                    {
                    case "--file":
                        fileName = args[++i];
                        break;

                    case "--tsa":
                        tsa = args[++i];
                        break;

                    case "--out":
                        outFile = args[++i];
                        break;

                    case "--hash":
                        hash = args[++i];
                        break;

                    case "--policy":
                        policy = args[++i];
                        break;

                    case "--nonce":
                        nonce = args[++i];
                        break;

                    case "--cert-req":
                        cert = true;
                        break;

                    case "--ssl-client-cert-file":
                        sslClientCertFile = args[++i];
                        break;

                    case "--ssl-client-cert-pass":
                        sslClientCertPass = args[++i];
                        break;

                    case "--http-auth-login":
                        httpAuthLogin = args[++i];
                        break;

                    case "--http-auth-pass":
                        httpAuthPass = args[++i];
                        break;

                    case "--asics":
                        isAsics = true;
                        break;

                    default:
                        ExitWithHelp("Invalid argument: " + args[i]);
                        break;
                    }

                    i++;
                }

                X509Certificate2 sslCert = null;
                if (!string.IsNullOrEmpty(sslClientCertFile))
                {
                    sslCert = new X509Certificate2(sslClientCertFile, sslClientCertPass);
                }

                NetworkCredential networkCredential = null;
                if (!string.IsNullOrEmpty(httpAuthLogin) && !string.IsNullOrEmpty(httpAuthPass))
                {
                    networkCredential = new NetworkCredential(httpAuthLogin, httpAuthPass);
                }

                UserCredentials credentials = null;
                if (networkCredential != null || sslCert != null)
                {
                    credentials = new UserCredentials(sslCert, networkCredential);
                }

                TimeStampToken token = SharedUtils.RequestTimeStamp(tsa, fileName, hash, policy, nonce, cert, credentials, new LogDelegate(LogMessage), true);
                if (isAsics)
                {
                    SharedUtils.SaveToAsicSimple(fileName, token, outFile);
                }
                else
                {
                    SharedUtils.SaveResponse(outFile, token);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                ExitWithHelp(null);
            }

            Console.WriteLine("Success");
        }
 Task <WriteResult> IEventStoreConnection.SetStreamMetadataAsync(string stream, int expectedMetastreamVersion,
                                                                 byte[] metadata,
                                                                 UserCredentials userCredentials)
 {
     return(_connection.SetStreamMetadataAsync(stream, expectedMetastreamVersion, metadata, userCredentials));
 }
        static UserCredentials GetUser(string name)
        {
            lock (Sync)
            {
                try
                {
                    if (_users == null)
                    {
                        var text = File.ReadAllText(CredentialsFileName);

                        _users = new Dictionary<string, UserCredentials>();
                        var lines = text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                        foreach (var line in lines)
                        {
                            var parts = line.Split('\t');
                            if (parts.Length == 3)
                            {
                                var user = new UserCredentials
                                    {
                                        Name = parts[0],
                                        Salt = Encoding.Unicode.GetString(Convert.FromBase64String(parts[1])),
                                        PasswordHash = parts[2],
                                    };
                                _users.Add(user.Name, user);
                            }
                        }
                    }
                }
                catch (Exception exc)
                {
                    WebLogger.Report(exc);
                }

                if (_users == null)
                    return null;

                UserCredentials res;
                _users.TryGetValue(name, out res);
                return res;
            }
        }
 Task IEventStoreConnection.SetSystemSettingsAsync(SystemSettings settings, UserCredentials userCredentials)
 {
     return(_connection.SetSystemSettingsAsync(settings, userCredentials));
 }
 Task <DeleteResult> IEventStoreConnection.DeleteStreamAsync(string stream, int expectedVersion, bool hardDelete,
                                                             UserCredentials userCredentials)
 {
     return(_connection.DeleteStreamAsync(stream, expectedVersion, hardDelete, userCredentials));
 }
 Task <WriteResult> IEventStoreConnection.AppendToStreamAsync(string stream, int expectedVersion,
                                                              IEnumerable <EventData> events, UserCredentials userCredentials)
 {
     return(_connection.AppendToStreamAsync(stream, expectedVersion, events, userCredentials));
 }
示例#34
0
 public Task <StreamMetadataResult> ReadMeta(string streamId, UserCredentials userCredentials = default) =>
 Client.GetStreamMetadataAsync(streamId, userCredentials: userCredentials);
示例#35
0
 public Task ReadAllBackward(UserCredentials userCredentials = default) =>
 Client.ReadAllAsync(Direction.Backwards, Position.End, 1, resolveLinkTos: false,
                     userCredentials: userCredentials)
 .ToArrayAsync()
 .AsTask();
示例#36
0
 public Task <DeleteResult> DeleteStream(string streamId, UserCredentials userCredentials = default) =>
 Client.TombstoneAsync(streamId, AnyStreamRevision.Any, userCredentials: userCredentials);
示例#37
0
 public RefreshTokenDelegatingHandler(UserCredentials credentials)
 {
     _credentials = credentials;
 }
示例#38
0
 public MockConnection(UserCredentials userCreds) : base(userCreds)
 {
 }
 EventStoreTransaction IEventStoreConnection.ContinueTransaction(long transactionId,
                                                                 UserCredentials userCredentials)
 {
     return(_connection.ContinueTransaction(transactionId, userCredentials));
 }
示例#40
0
 public Task <WriteResult> AppendStream(string streamId, UserCredentials userCredentials = default) =>
 Client.AppendToStreamAsync(streamId, AnyStreamRevision.Any, CreateTestEvents(3),
                            userCredentials: userCredentials);
 Task <EventStoreTransaction> IEventStoreConnection.StartTransactionAsync(string stream, int expectedVersion,
                                                                          UserCredentials userCredentials)
 {
     return(_connection.StartTransactionAsync(stream, expectedVersion, userCredentials));
 }
示例#42
0
 public Task ReadStreamBackward(string streamId, UserCredentials userCredentials = default) =>
 Client.ReadStreamAsync(Direction.Backwards, streamId, StreamRevision.Start, 1, resolveLinkTos: false,
                        userCredentials: userCredentials)
 .ToArrayAsync()
 .AsTask();
 Task <WriteResult> IEventStoreConnection.AppendToStreamAsync(string stream, int expectedVersion,
                                                              UserCredentials userCredentials, params EventData[] events)
 {
     return(_connection.AppendToStreamAsync(stream, expectedVersion, userCredentials, events));
 }
 /// <summary>
 /// Action bound to <see cref="UpdatePasswordButtonViewModel"/> button.
 /// </summary>
 private async void OnUpdatePasswordButtonPressed()
 {
     var updatedCredentials = new UserCredentials(accountService.CurrentUser.Username, PasswordEntryViewModel.Text);
     await accountService.UpdatePasswordAsync(updatedCredentials);
 }
		public LoginServiceTest()
		{
			
			_service = new LoginService();
			_userCredentials = new UserCredentials {UserName = "******", Password = "******"};
		}
 Task <AllEventsSlice> IEventStoreConnection.ReadAllEventsBackwardAsync(Position position, int maxCount,
                                                                        bool resolveLinkTos,
                                                                        UserCredentials userCredentials)
 {
     return(_connection.ReadAllEventsBackwardAsync(position, maxCount, resolveLinkTos, userCredentials));
 }
 static bool CheckPassword(UserCredentials user, string password)
 {
     var hash = GetPasswordHash(user.Salt, password);
     var res = (user.PasswordHash == hash);
     return res;
 }
示例#48
0
 public LoginRequestMessage(UserCredentials[] credentials)
 {
     if (credentials == null)
         throw new ArgumentNullException ("credentials");
     this.credentials = credentials;
 }
 Task <RawStreamMetadataResult> IEventStoreConnection.GetStreamMetadataAsRawBytesAsync(string stream,
                                                                                       UserCredentials userCredentials)
 {
     return(_connection.GetStreamMetadataAsRawBytesAsync(stream, userCredentials));
 }
 Task <StreamEventsSlice> IEventStoreConnection.ReadStreamEventsBackwardAsync(string stream, int start, int count,
                                                                              bool resolveLinkTos,
                                                                              UserCredentials userCredentials)
 {
     return(_connection.ReadStreamEventsBackwardAsync(stream, start, count, resolveLinkTos, userCredentials));
 }
 EventStoreStreamCatchUpSubscription IEventStoreConnection.SubscribeToStreamFrom(string stream,
                                                                                 int?lastCheckpoint, bool resolveLinkTos,
                                                                                 Action <EventStoreCatchUpSubscription, ResolvedEvent> eventAppeared,
                                                                                 Action <EventStoreCatchUpSubscription> liveProcessingStarted,
                                                                                 Action <EventStoreCatchUpSubscription, SubscriptionDropReason, Exception> subscriptionDropped,
                                                                                 UserCredentials userCredentials, int readBatchSize)
 {
     if (userCredentials == null)
     {
         throw new ArgumentNullException("userCredentials");
     }
     return(_connection.SubscribeToStreamFrom(stream, lastCheckpoint, resolveLinkTos, eventAppeared,
                                              liveProcessingStarted, subscriptionDropped, userCredentials, readBatchSize));
 }
 Task <EventReadResult> IEventStoreConnection.ReadEventAsync(string stream, int eventNumber, bool resolveLinkTos,
                                                             UserCredentials userCredentials)
 {
     return(_connection.ReadEventAsync(stream, eventNumber, resolveLinkTos, userCredentials));
 }
示例#53
0
 protected AuthenticationTestBase(UserCredentials userCredentials = null)
 {
     _userCredentials = userCredentials;
 }
 /// <summary>
 /// Read events until the given position async.
 /// </summary>
 /// <param name="connection">The connection.</param>
 /// <param name="resolveLinkTos">Whether to resolve Link events.</param>
 /// <param name="userCredentials">User credentials for the operation.</param>
 /// <param name="lastCommitPosition">The commit position to read until.</param>
 /// <param name="lastEventNumber">The event number to read until.</param>
 /// <returns></returns>
 protected override Task ReadEventsTillAsync(IEventStoreConnection connection, bool resolveLinkTos,
                                             UserCredentials userCredentials, long?lastCommitPosition, long?lastEventNumber) =>
 ReadEventsInternalAsync(connection, resolveLinkTos, userCredentials, lastCommitPosition);