示例#1
0
        public async Task CanLogInWithAPreviouslyRegisteredUser()
        {
            // Arrange
            var server    = ServerFactory.CreateDefaultServer();
            var client    = ServerFactory.CreateDefaultClient(server);
            var newClient = ServerFactory.CreateDefaultClient(server);

            var userName = $"{Guid.NewGuid()}@example.com";
            var password = $"!Test.Password1$";

            // Act & Assert
            await UserStories.RegisterNewUserAsync(client, userName, password);

            // Use a new client to simulate a new browser session.
            await UserStories.LoginExistingUserAsync(newClient, userName, password);
        }
示例#2
0
        public async Task CanLogInWithTwoFactorAuthentication()
        {
            // Arrange
            var server    = ServerFactory.CreateDefaultServer();
            var client    = ServerFactory.CreateDefaultClient(server);
            var newClient = ServerFactory.CreateDefaultClient(server);

            var userName = $"{Guid.NewGuid()}@example.com";
            var password = $"!Test.Password1$";

            var loggedIn = await UserStories.RegisterNewUserAsync(client, userName, password);

            var showRecoveryCodes = await UserStories.EnableTwoFactorAuthentication(loggedIn, twoFactorEnabled : false);

            var twoFactorKey = showRecoveryCodes.Context[EnableAuthenticator.AuthenticatorKey];

            // Act & Assert
            // Use a new client to simulate a new browser session.
            await UserStories.LoginExistingUser2FaAsync(newClient, userName, password, twoFactorKey);
        }