From the course: Azure Functions for Developers
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Implementing the SafeBrowsingService as a middleware component - Azure Tutorial
From the course: Azure Functions for Developers
Implementing the SafeBrowsingService as a middleware component
- [Instructor] The problem with the current safe browsing service implementation is that it's being used too late in the processing pipeline. I don't even want to raise their function to be invoked if the URL has been flagged as an unsafe website. And in addition to that, I need to validate the format of the URL itself, something that I'm not doing right now. So we're going to fix this by implementing a middleware that validates the URL, invokes the safe browsing service, and returns the correct HTTP status codes. Okay, let's begin by adding a new class named "SafeBrowsingMiddleware." So let's do this. SafeBrowsingMiddleware. And of course, let's use files code, and public. Okay, now, middlewares in Azure Functions are similar to the ones we can find in ASP.NET Core, but they have to implement the IFunctionsWorkerMiddleware interface. So let's do that. IFunctionsWorkerMiddleware. And as you can see, it only has one member, which is this invoke method. And luckily we have access to the…
Contents
-
-
-
-
-
-
(Locked)
Refactoring the PDF creation logic to the PdfCreatorService class3m 55s
-
(Locked)
Creating the SafeBrowsingService for filtering out unsafe websites5m 50s
-
(Locked)
Implementing the SafeBrowsingService as a middleware component1m 44s
-
(Locked)
Implementing the middleware logic and validations4m 25s
-
(Locked)
Registering the middleware in the pipeline and testing the application4m 25s
-
(Locked)
-
-
-