Client-server auth test

Before moving further, it's definitely time to perform a client/server interaction test to ensure that our authorization pattern is working as expected.

From the Visual Studio source code editing interface, we can put a breakpoint right below the Put method of QuizController:

Once done, we can launch the application in debug mode, navigate from the Home view to the Login view, and authenticate ourselves. Right after that, the Create a Quiz menu element should appear, allowing us to click on it.

From there, we can fill in the form with some random text and click on the Save button. The form will consequently call the Put method of QuizController, hopefully triggering our breakpoint. When it happens, open a Watch window (Debug | Windows | Watch | Watch 1) and check the this.User.Identity.IsAuthenticated property value:

If it's true, it means that we've been successfully authenticated. That shouldn't be surprising, since our request already managed to get inside a method protected by an [Authorize] attribute.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.197.10