Ejemplo n.º 1
0
 public CredentialVmBuilder(string credentialId)
 {
     _credential              = new CredentialVM();
     _credential.BirthDate    = new DateTime(1990, 6, 1);
     _credential.CreationDate = DateTime.UtcNow;
     _credential.CredentialId = credentialId;
     _credential.DisplayName  = credentialId;
     _credential.Email        = credentialId + "@mail.com";
 }
Ejemplo n.º 2
0
        public async Task Success(string credentialId)
        {
            // Arrange
            Credential credential = _credentialStore
                                    .Credentials
                                    .FirstOrDefault(x => x.CredentialId == credentialId);

            CredentialVM expected = new CredentialVM(credential);

            // Act
            IActionResult result = await _sut.GetByCredentialId(credentialId);

            CredentialVM actual = result.AsElementView <Credential, CredentialVM>();

            // Assert
            Assert.Equal(expected, actual, _credentialVmComparer);
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <GroupsVM> > GetAllGroups(CredentialVM credentialVm)
        {
            var list = new List <GroupsVM>();

            var Credential = new UserData
            {
                SecretId      = credentialVm.SecretId,
                TenantId      = credentialVm.TenantId,
                ApplicationId = credentialVm.ApplicationId
            };

            var Result = await _powerService.GetAllGroups(Credential);

            Result.ForEach(s =>
            {
                list.Add(new GroupsVM {
                    GroupId = s.Id, GroupName = s.Name
                });
            });
            return(list.ToArray());
        }
Ejemplo n.º 4
0
        private CredentialVM Credentials(string username, string password)
        {
            var size  = 32;
            var bytes = new byte[size];

            using (var random = new RNGCryptoServiceProvider())
                random.GetNonZeroBytes(bytes);

            var salt = Encoding.ASCII.GetString(bytes, 0, bytes.Count());

            var encoded = Encode(password + salt);

            var credentials = new CredentialVM
            {
                Username = username,
                Salt     = salt,
                Password = encoded
            };

            return(credentials);
        }