コード例 #1
0
        public void GenerateExplicitTokenRestoreTokenAndRerestorTokenTest()
        {
            SecurityWS    target    = new SecurityWS();
            KeyLengthEnum keyLength = KeyLengthEnum.Sixteen;
            KeyLengthEnum initializationVectorLength = KeyLengthEnum.ThirtyTwo;
            String        token         = String.Empty;
            String        restoredToken = String.Empty;

            // Generazione del token
            token = target.GenerateExplicitToken(userId, keyLength, initializationVectorLength);

            // Sleep per 100 millisecondi
            Thread.Sleep(100);

            // Ripristino del token
            restoredToken = target.RestoreToken(userId, token);

            // Sleep per 5000 millisecondi
            Thread.Sleep(5000);

            // Richiesta di ripristino del token
            restoredToken = target.RestoreToken(userId, token);

            // Salvataggio del token nel context
            this.TestContext.Properties["token"] = token;

            Assert.IsFalse(String.IsNullOrEmpty(restoredToken));

            //this.RemoveTokenTest();
        }
コード例 #2
0
        public void GenerateExplicitTokenRestoreTokenAndRerestorToken2Test()
        {
            SecurityWS    target    = new SecurityWS();
            KeyLengthEnum keyLength = KeyLengthEnum.Sixteen;
            KeyLengthEnum initializationVectorLength = KeyLengthEnum.ThirtyTwo;
            String        token         = String.Empty;
            String        restoredToken = String.Empty;

            // Generazione del token
            token = target.GenerateExplicitToken(userId, keyLength, initializationVectorLength);

            // Sleep per 100 millisecondi
            Thread.Sleep(100);

            // Ripristino del token
            restoredToken = target.RestoreToken(userId, token);

            // Invalidazione del token
            target.RemoveToken(userId, token);

            // Richiesta di ripristino del token
            restoredToken = target.RestoreToken(userId, token);
        }