To secure access to our dividend calendar API, we are going to use a client API key. There are many ways to share client keys with your clients, but we will not be discussing them here. You can come up with your own strategies. What we will be focusing on is how to enable authenticated and authorized client access to our API.
To keep things simple, we will be using therepository pattern. The repository pattern helps to decouple our program from the underlying data store. This pattern improves maintainability and allows you to change the underlying data store without affecting the program. For our repository, our keys will be defined in a class, but in a commercial project, you would store the keys in a data store, such as Cosmos DB, SQL Server, or Azure Key Vault. You decide the strategy that best suits your needs, which is the main reason why we use the repository pattern as you are in control of the underlying data...