private static async Task AssertDoesGetAccessTokenUsingRefreshTokenCookie(IJsonServiceClient client) { var authResponse = await client.PostAsync(new Authenticate { provider = "credentials", UserName = "******", Password = "******", }); var initialAccessToken = client.GetTokenCookie(); var initialRefreshToken = client.GetRefreshTokenCookie(); Assert.That(initialAccessToken, Is.Not.Null); Assert.That(initialRefreshToken, Is.Not.Null); var request = new Secured { Name = "test" }; var response = await client.SendAsync(request); Assert.That(response.Result, Is.EqualTo(request.Name)); client.Post(new InvalidateLastAccessToken()); // JwtAuthProvider.PrintDump(initialAccessToken); // JwtAuthProvider.PrintDump(initialRefreshToken); response = await client.SendAsync(request); Assert.That(response.Result, Is.EqualTo(request.Name)); var latestAccessToken = client.GetTokenCookie(); Assert.That(latestAccessToken, Is.Not.EqualTo(initialAccessToken)); }
private static void AssertDoesGetAccessTokenUsingRefreshTokenCookie(IJsonServiceClient client) { var authResponse = client.Post(new Authenticate { provider = "credentials", UserName = Username, Password = Password }); var initialAccessToken = client.GetTokenCookie(); var initialRefreshToken = client.GetRefreshTokenCookie(); Assert.That(initialAccessToken, Is.Not.Null); Assert.That(initialRefreshToken, Is.Not.Null); var request = new Secured { Name = "test" }; var response = client.Send(request); Assert.That(response.Result, Is.EqualTo(request.Name)); var jwtAuthProvider = AuthenticateService.GetRequiredJwtAuthProvider(); jwtAuthProvider.InvalidateJwtIds.Add(jwtAuthProvider.LastJwtId()); // JwtAuthProvider.PrintDump(initialAccessToken); // JwtAuthProvider.PrintDump(initialRefreshToken); response = client.Send(request); Assert.That(response.Result, Is.EqualTo(request.Name)); var latestAccessToken = client.GetTokenCookie(); Assert.That(latestAccessToken, Is.Not.EqualTo(initialAccessToken)); }