Exemplo n.º 1
0
        /// <exception cref="System.Exception"/>
        private StringSignerSecretProvider CreateStringSignerSecretProvider()
        {
            StringSignerSecretProvider secretProvider = new StringSignerSecretProvider();
            Properties secretProviderProps            = new Properties();

            secretProviderProps.SetProperty(AuthenticationFilter.SignatureSecret, "secret");
            secretProvider.Init(secretProviderProps, null, -1);
            return(secretProvider);
        }
        public virtual void TestGetSecrets()
        {
            string secretStr = "secret";
            StringSignerSecretProvider secretProvider = new StringSignerSecretProvider();
            Properties secretProviderProps            = new Properties();

            secretProviderProps.SetProperty(AuthenticationFilter.SignatureSecret, "secret");
            secretProvider.Init(secretProviderProps, null, -1);
            byte[] secretBytes = Runtime.GetBytesForString(secretStr);
            Assert.AssertArrayEquals(secretBytes, secretProvider.GetCurrentSecret());
            byte[][] allSecrets = secretProvider.GetAllSecrets();
            Assert.Equal(1, allSecrets.Length);
            Assert.AssertArrayEquals(secretBytes, allSecrets[0]);
        }