public void PlainTextPassword()
        {
            // Arrange
            UsernamePasswordInput input = new UsernamePasswordInput("user", "plain_text_password");

            // Act
            char[] charPassword = input.PasswordToCharArray();

            // Assert
            Assert.IsTrue(input.HasPassword());
            CollectionAssert.AreEqual("plain_text_password".ToCharArray(), charPassword);
        }
Ejemplo n.º 2
0
 public UsernamePasswordRequest(
     IServiceBundle serviceBundle,
     AuthenticationRequestParameters authenticationRequestParameters,
     ApiEvent.ApiIds apiId,
     UsernamePasswordInput usernamePasswordInput)
     : base(serviceBundle, authenticationRequestParameters, apiId)
 {
     _usernamePasswordInput       = usernamePasswordInput ?? throw new ArgumentNullException(nameof(usernamePasswordInput));
     _commonNonInteractiveHandler = new CommonNonInteractiveHandler(
         authenticationRequestParameters.RequestContext,
         usernamePasswordInput,
         serviceBundle);
 }
        public void SecureStringPassword()
        {
            // Arrange
            SecureString secureString = new SecureString();

            "secure_string_password".ToCharArray().ToList().ForEach(c => secureString.AppendChar(c));
            UsernamePasswordInput input = new UsernamePasswordInput("user", secureString);

            // Act
            char[] charPassword = input.PasswordToCharArray();

            // Assert
            Assert.IsTrue(input.HasPassword());
            CollectionAssert.AreEqual("secure_string_password".ToCharArray(), charPassword);
        }