Securing REST Web API in ASP.NET

The REST Web Api endpoint the customer has developed & deployed to Azure website has anonymous access. The REST end point must be secured. I was investigating the best and easier way to secure the REST endpoint in ASP.NET.

There are multiple ways to secure the REST end point.
1. Open ID (RSA key pair)
2. OAuth

The OAuth will require bit of the work which can be done using Azure AD as the claims provider. However Open ID is very well received in the community and easy to implement by using the RSA key pair. The details of RSA key pairs is discussed in the following blog post.

Making your ASP.NET Web API’s secure ->

I coded a sample REST Web API to test it out. It works.

In Summary,

• Using the RSACryptoServiceProvider class create the public / private key.
• Encrypt the token using RSAClass.Enrypt
• Using Fiddler pass the token “Authorization-Token” in the header.

Please see the following other links for the reference on this topic:

About Pankaj

I am a Developer and my linked profile is
This entry was posted in Azure. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s