DEV Community

Wasim Ul Masood
Wasim Ul Masood

Posted on

Secure Your Rest APIs with Azure Active Directory

Secure Your Rest APIs with Azure Active Directory

ASP.NET Core Web API 3.0 with Azure AD B2 Authentication, Swagger UI.

A sample test web application built in ASP.NET Core 3.0 to perform such tasks as:

  • Authenticate users with Azure AD B2C( Single Sign In with Email, Facebook & Github)
  • Protect Web APIs
  • Redeem authorization code
  • Call a protected Web API from Web Application

Configuration

"Authentication": {
    "Authentication": {
    "AzureAd": {
      "Instance": "",
      "TenantId": "",
      "ClientId": "",
      "ClientSecret": "",
      "PostLogoutRedirectUri": "https://localhost:44397/",
      "ApiIdentifier": "",
      "B2C": {
        "SignInOrSignUpPolicy": "B2C_1_testsignupandsigninpolicy",
        "EditProfilePolicy": "B2C_1_TestProfileEditPolicy",
        "ResetPasswordPolicy": "B2C_1_password-reset"
      }
    }
  },
  "TestServiceOptions": {
    "BaseUrl": "https://localhost:44327/"
  } 
Enter fullscreen mode Exit fullscreen mode

ASP.NET CORE Web API Authentication settings

"Authentication": {
    "Authentication": {
    "AzureAd": {
      "Instance": "",
      "TenantId": "",
      "Audience": "",
      "SignInOrSignUpPolicy": ""
    }
  }
Enter fullscreen mode Exit fullscreen mode

Swagger UI

Web API Swagger UI - https://localhost:44327/swagger
Enter fullscreen mode Exit fullscreen mode

Complete Project: WEB API With Azure AD
`

Top comments (0)