/dnc-identity-identityserver

An example of IdentityServer4 and ASP.NET Identity, Ocelot and Consul

Primary LanguageC#

dnc-identity-identityserver

An example of:

Getting Started

Start Consul

  • Download Consul for Windows
  • Unzip to the path, for example, C:\Consul. Then add this path to the PATH environment
  • Fire up Consul with the following command line
	consul agent -dev
  • Open browser with the link http://localhost:8500

Start Services

  • Modify the connection string in DncIds4.IdentityServer > appsettings.Development.json
  • Configure solution to run multiple project

Start Multiple Project

  • Fire up by Ctrl + F5
  • Back to browser with the link http://localhost:8500 to verify these services has been registered to Consul

Services in Consul

Identity Service

Resource Service

Use Postman

Account Registration

1. Request a token

Request Token 01

Request Token 02

Request Token 03

2. Register new account

  • Endpoint: http://localhost:5003/account/register
  • Json body
{
  "username": "kim.admin",
  "emailAddress": "kim.admin@mail.com",
  "password": "Kimadmin@123",
  "isAdmin": true
}

Register Account Request

Login and retrieve weather information

1. Request a token

Request Token 01

Request Token 02

2. Get weather forecast information

  • Endpoint: http://localhost:5003/weather/forecast

Get weather forecast Request

Highlighted Points

  1. Use IHostedService to