Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as C# by 3da ( 5 years ago )
//Teeworlds Server generates "request token" 
            var serverToken = RandomStr();

            //Teeworlds Server sends "request token" to client 

            //Client sends request to Auth server (wrong pw)
            var authResult = await authService.Authenticate("3da", "12345", serverToken);

            Assert.IsFalse(authResult.IsSuccess);


            //Client sends request to Auth server (correct pw)
            authResult = await authService.Authenticate("3da", "123", serverToken);

            Assert.IsTrue(authResult.IsSuccess);

            //Client sends token to Teeworlds Server

            //Teeworlds server validates token (wrong token)
            var validateResult2 = await authService.Validate("3da", "wrong_token", serverToken);

            Assert.IsFalse(validateResult2.Success);

            //Teeworlds server validates token (wrong "request token")
            validateResult2 = await authService.Validate("3da", authResult.Token, "wrong_token");

            Assert.IsFalse(validateResult2.Success);

            //Teeworlds server validates token (correct tokens)
            validateResult2 = await authService.Validate("3da", authResult.Token, serverToken);

            Assert.IsTrue(validateResult2.Success);

 

Revise this Paste

Parent: 103192
Your Name: Code Language: