Skip to main content

Posts

Showing posts with the label Swagger UI

Swagger Authentication in Dot Net Core

Swagger is really a cool tool to document and test out REST API's. This blog tells about steps to enable Swagger on a Dot Net Core Application along with Authentication as well. In this demo, I am using Azure Active Directory OAuth 2 Authentication to protect my Web API from unauthenticated access. We will be enabling OAuth 2 Authentication on our Swagger UI as well so that we can authenticate using Swagger and then invoke our APIs successfully. OAuth 2 Authentication works by using Bearer Token to validate the caller and provide access to resource. This requires us to register an Application in the Active Directory tenant, which will be used for authentication of the API, and we will use the same app to authenticate Swagger as well. Lets get started - Assuming you have a Dot Net Core Web API that's authenticated via Azure Active Directory OAuth 2 Authentication. Azure Active Directory Application Registration - We need to set up our Active Directory Application so th...

Swagger UI in ASP.NET Web API

What is SWAGGER UI? Swagger UI is an HTML/CSS/JS framework that provides interactive documentation of your RESTful APIs and generates a navigable UI of the documentation. Swagger UI provides automatically generated HTML assets that give you automatic documentation and even an online test tool. It is extremely easy to set up, and comes with a lot of configurable options like XML Documentation, various kinds of Authentications (Basic, OAUTH2, API key), etc. which can be configured depending on the security schemes set up in your APIs. This can reduce the time and efforts you spend on creating your Client Application to consume and test your RESTful APIs. With minimum amount of code, you will get an easy to use test client for your APIs. Benefits of using SWAGGER UI? A Sandbox! Create test client for your APIs in seconds! It's comprehensible for developers and non-developers. It's easily adjustable. It’s like a sitemap for your API. How to set Up the Swagger...