Skip to content

Commit c763781

Browse files
authored
Merge pull request skoruba#287 from skoruba/dev
Beta version 7
2 parents 5cda5fd + dcda2ee commit c763781

File tree

692 files changed

+45263
-6408
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

692 files changed

+45263
-6408
lines changed

README.md

Lines changed: 103 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ The application is written in the **Asp.Net Core MVC - using .NET Core 2.2**
2525
- Install the dotnet new template:
2626

2727
```sh
28-
dotnet new -i Skoruba.IdentityServer4.Admin.Templates::1.0.0-beta6
28+
dotnet new -i Skoruba.IdentityServer4.Admin.Templates::1.0.0-beta7
2929
```
3030

3131
- Create new project:
@@ -56,6 +56,7 @@ Project template options:
5656

5757
- Set Startup projects:
5858
- Skoruba.IdentityServer4.Admin
59+
- Skoruba.IdentityServer4.Admin.Api
5960
- Skoruba.IdentityServer4.STS.Identity
6061

6162
## Configuration of Administration for Deployment
@@ -223,8 +224,82 @@ or using `Email`:
223224
}
224225
```
225226

227+
## How to configure API & Swagger
228+
229+
- For development is running on url - `http://localhost:5001` and swagger UI is available on url - `http://localhost:5001/swagger`
230+
- For swagger UI is configured a client and an API in STS:
231+
232+
```
233+
"AdminApiConfiguration": {
234+
"IdentityServerBaseUrl": "http://localhost:5000",
235+
"OidcSwaggerUIClientId": "skoruba_identity_admin_api_swaggerui",
236+
"OidcApiName": "skoruba_identity_admin_api"
237+
}
238+
```
239+
240+
- Swagger UI contains following endpoints:
241+
242+
![SwaggerUI-preview](docs/Images/Admin-Swagger-UI.PNG)
243+
244+
245+
## How to configure an external provider in STS
246+
247+
- In `Skoruba.IdentityServer4.STS.Identity/Helpers/StartupHelpers.cs` - is method called `AddExternalProviders` which contains the example with `GitHub` and in `appsettings.json`:
248+
249+
```
250+
"ExternalProvidersConfiguration": {
251+
"UseGitHubProvider": false,
252+
"GitHubClientId": "",
253+
"GitHubClientSecret": ""
254+
}
255+
```
256+
257+
- It is possible to extend `ExternalProvidersConfiguration` with another configuration properties.
258+
259+
### List of external providers for ASP.NET Core:
260+
- https://github.com/aspnet-contrib/AspNet.Security.OAuth.Providers
261+
- https://docs.microsoft.com/en-us/aspnet/core/security/authentication/social/
262+
263+
### Azure AD
264+
- Great article how to set up Azure AD:
265+
- https://azure.microsoft.com/cs-cz/resources/samples/active-directory-dotnet-webapp-openidconnect-aspnetcore/
266+
267+
## Email service
268+
269+
- It is possible to set up emails via:
270+
271+
### SendGrid
272+
273+
In STS project - in `appsettings.json`:
274+
```
275+
"SendgridConfiguration": {
276+
"ApiKey": "",
277+
"SourceEmail": "",
278+
"SourceName": ""
279+
}
280+
```
281+
282+
### SMTP
283+
284+
```
285+
"SmtpConfiguration": {
286+
"Host": "",
287+
"Login": "",
288+
"Password": ""
289+
}
290+
```
291+
226292
## Localizations - labels, messages
227293

294+
- The project has following translations:
295+
- English
296+
- Chinese
297+
- Russian
298+
- Persian
299+
- Swedish
300+
301+
#### Feel free to send a PR with your translation. :blush:
302+
228303
- All labels and messages are stored in the resources `.resx` - locatated in `/Resources`
229304

230305
- Client label descriptions from - http://docs.identityserver.io/en/latest/reference/client.html
@@ -248,7 +323,11 @@ or using `Email`:
248323

249324
- STS:
250325

251-
- `Skoruba.IdentityServer4.STS.Identity` - project that contains the instance of IdentityServer4 and combine these samples - [Quickstart UI for the IdentityServer4 with Asp.Net Core Identity and EF Core storage](https://github.com/IdentityServer/IdentityServer4.Samples/tree/master/Quickstarts/Combined_AspId_and_EFStorage) and [damienbod - IdentityServer4 and Identity template](https://github.com/damienbod/IdentityServer4AspNetCoreIdentityTemplate)
326+
- `Skoruba.IdentityServer4.STS.Identity` - project that contains the instance of IdentityServer4 and combine these samples - [Quickstart UI for the IdentityServer4 with Asp.Net Core Identity and EF Core storage](https://github.com/IdentityServer/IdentityServer4/tree/master/samples/Quickstarts/9_Combined_AspId_and_EFStorage) and [damienbod - IdentityServer4 and Identity template](https://github.com/damienbod/IdentityServer4AspNetCoreIdentityTemplate)
327+
328+
- Admin UI Api:
329+
330+
- `Skoruba.IdentityServer4.Admin.Api` - project with Api for managing data of IdentityServer4 and Asp.Net Core Identity, with swagger support as well
252331

253332
- Admin UI:
254333

@@ -262,9 +341,11 @@ or using `Email`:
262341

263342
- `Skoruba.IdentityServer4.Admin.EntityFramework` - EF Core data layer that contains Entities for the IdentityServer4
264343

265-
- `Skoruba.IdentityServer4.Admin.EntityFramework.Identity` - EF Core data layer that contains Entities for the Asp.Net Core Identity
344+
- `Skoruba.IdentityServer4.Admin.EntityFramework.Identity` - EF Core data layer that contains Repositories for the Asp.Net Core Identity
345+
346+
- `Skoruba.IdentityServer4.Admin.EntityFramework.Extensions` - project that contains extensions related to EntityFramework
266347

267-
- `Skoruba.IdentityServer4.Admin.EntityFramework.DbContexts` - project that contains DbContexts for the IdentityServer4, Logging and Asp.Net Core Identity
348+
- `Skoruba.IdentityServer4.Admin.EntityFramework.Shared` - project that contains DbContexts for the IdentityServer4, Logging and Asp.Net Core Identity, inluding shared Identity entities
268349

269350
- Tests:
270351

@@ -339,7 +420,7 @@ It is possible to define the configuration according the client type - by defaul
339420

340421
![Skoruba.IdentityServer4.Admin Diagram](docs/Images/Skoruba.IdentityServer4.Admin-App-Diagram.png)
341422

342-
## Plan & Vision
423+
## Roadmap & Vision
343424

344425
### 1.0.0:
345426

@@ -354,28 +435,28 @@ It is possible to define the configuration according the client type - by defaul
354435
- [x] Chinese
355436
- [x] Russian
356437
- [x] Persian
438+
- [x] Swedish
357439
- [x] Manage profile
358440
- [x] Password reset
359441
- [x] Link account to an external provider (example with Github)
360442
- [x] Two-Factor Authentication (2FA)
361443
- [x] User registration
362444
- [x] Email service
445+
- [x] SendGrid
446+
- [x] Add API
447+
- [x] IdentityServer4
448+
- [x] Asp.Net Core Identity
449+
- [x] Add swagger support
363450

364-
### 1.1.0:
451+
### 1.1.0
452+
- [ ] Add audit logs to track changes ([#61](https://github.com/skoruba/IdentityServer4.Admin/issues/61))
453+
454+
### 2.0.0:
365455

366456
- [ ] Docker support ([#121](https://github.com/skoruba/IdentityServer4.Admin/issues/121))
367-
- [ ] Add audit logs to track changes ([#61](https://github.com/skoruba/IdentityServer4.Admin/issues/61))
368457
- [ ] Create a project template using dotnet CLI - `dotnet new template`
369458
- [ ] Second template: The administration of the IdentityServer4 (without Asp.Net Core Identity) ([#79](https://github.com/skoruba/IdentityServer4.Admin/issues/79))
370459

371-
372-
### 2.0.0:
373-
374-
- [ ] Add API ([#105](https://github.com/skoruba/IdentityServer4.Admin/issues/105))
375-
- [ ] IdentityServer4
376-
- [ ] Asp.Net Core Identity
377-
- [ ] Add swagger support
378-
379460
### Future:
380461

381462
- Add UI tests ([#97](https://github.com/skoruba/IdentityServer4.Admin/issues/97), [#116](https://github.com/skoruba/IdentityServer4.Admin/issues/116))
@@ -415,6 +496,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
415496
| [<img src="https://avatars3.githubusercontent.com/u/35664089?s=460&v=3" width="100px;"/><br /><sub> Jan Škoruba</sub>](https://github.com/skoruba) <br /> 💻 💬 📖 💡 🤔 | [<img src="https://avatars0.githubusercontent.com/u/6831144?s=460&v=3" width="100px;"/><br /><sub> Tomáš Hübelbauer</sub>](https://github.com/TomasHubelbauer) <br /> 💻 👀 📖 🤔 | [<img src="https://avatars0.githubusercontent.com/u/1004852?s=460&v=3" width="100px;"/><br /><sub>Michał Drzał </sub>](https://github.com/xmichaelx) <br />💻 👀 📖 💡 🤔 | [<img src="https://avatars0.githubusercontent.com/u/2261603?s=460&v=3" width="100px;"/><br /><sub>cerginio </sub>](https://github.com/cerginio) <br /> 💻 🐛 💡 🤔 | [<img src="https://avatars3.githubusercontent.com/u/13407080?s=460&v=3" width="100px;"/><br /><sub>Sven Dummis </sub>](https://github.com/svendu) <br /> 📖| [<img src="https://avatars1.githubusercontent.com/u/1687087?s=460&v=3" width="100px;"/><br /><sub>Seaear</sub>](https://github.com/Seaear) <br />💻 🌍|
416497
| :---: | :---: | :---: | :---: | :---: | :---: |
417498
|[<img src="https://avatars1.githubusercontent.com/u/1150473?s=460&v=3" width="118px;"/><br /><sub>Rune Antonsen </sub>](https://github.com/ruant) <br />🐛|[<img src="https://avatars1.githubusercontent.com/u/5537607?s=460&v=3" width="118px;"/><br /><sub>Sindre Njøsen </sub>](https://github.com/Sindrenj) <br />💻|[<img src="https://avatars1.githubusercontent.com/u/40323674?s=460&v=3" width="118px;"/><br /><sub>Alevtina Brown </sub>](https://github.com/alev7ina) <br />🌍|[<img src="https://avatars3.githubusercontent.com/u/29726153?s=460&v=3" width="118px;"/><br /><sub>Brice </sub>](https://github.com/Brice-xCIT) <br />💻|[<img src="https://avatars0.githubusercontent.com/u/17114154?s=460&v=3" width="118px;"/><br /><sub>TheEvilPenguin </sub>](https://github.com/TheEvilPenguin) <br />💻|[<img src="https://avatars3.githubusercontent.com/u/15545395?s=460&v=3" width="118px;"/><br /><sub>Saeed Rahmani </sub>](https://github.com/saeedrahmo) <br />🌍|
499+
|[<img src="https://avatars0.githubusercontent.com/u/15867612?s=460&v=3" width="118px;"/><br /><sub>Andy Yu </sub>](https://github.com/Zyxious) <br />🌍|
418500
<!-- prettier-ignore-end -->
419501

420502
This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification.
@@ -425,3 +507,9 @@ Contributions of any kind are welcome!
425507
I am happy to share my attempt of the implementation of the administration for IdentityServer4 and ASP.NET Core Identity.
426508

427509
Any feedback is welcome - feel free to create an issue or send me an email - [[email protected]](mailto:[email protected]). Thank you :blush:
510+
511+
## Support and Donation 🕊️
512+
513+
If you like my work, you can support me by donation. 👍
514+
515+
https://www.paypal.me/skoruba

Skoruba.IdentityServer4.Admin.sln

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27130.2027
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.28803.452
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{588205D4-3A30-4DA4-849D-C7422C396DAA}"
77
EndProject
@@ -27,9 +27,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.Adm
2727
EndProject
2828
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.Admin.BusinessLogic.Identity", "src\Skoruba.IdentityServer4.Admin.BusinessLogic.Identity\Skoruba.IdentityServer4.Admin.BusinessLogic.Identity.csproj", "{CA63CC7B-BE27-4737-AE91-42E43F729A1E}"
2929
EndProject
30-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.Admin.EntityFramework.DbContexts", "src\Skoruba.IdentityServer4.Admin.EntityFramework.DbContexts\Skoruba.IdentityServer4.Admin.EntityFramework.DbContexts.csproj", "{81019B1A-C554-44BA-A9EF-6BE6A223AD20}"
30+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.STS.Identity.IntegrationTests", "tests\Skoruba.IdentityServer4.STS.Identity.IntegrationTests\Skoruba.IdentityServer4.STS.Identity.IntegrationTests.csproj", "{83319150-92D2-408C-A944-52DBE6AB8B37}"
3131
EndProject
32-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skoruba.IdentityServer4.STS.Identity.IntegrationTests", "tests\Skoruba.IdentityServer4.STS.Identity.IntegrationTests\Skoruba.IdentityServer4.STS.Identity.IntegrationTests.csproj", "{83319150-92D2-408C-A944-52DBE6AB8B37}"
32+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.Admin.Api", "src\Skoruba.IdentityServer4.Admin.Api\Skoruba.IdentityServer4.Admin.Api.csproj", "{8F112368-2E45-4C3A-922E-85AB6056F559}"
33+
EndProject
34+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Skoruba.IdentityServer4.Admin.EntityFramework.Shared", "src\Skoruba.IdentityServer4.Admin.EntityFramework.Shared\Skoruba.IdentityServer4.Admin.EntityFramework.Shared.csproj", "{E18F8C70-7448-4039-9D78-1369D7F498EF}"
35+
EndProject
36+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Skoruba.IdentityServer4.Admin.EntityFramework.Extensions", "src\Skoruba.IdentityServer4.Admin.EntityFramework.Extensions\Skoruba.IdentityServer4.Admin.EntityFramework.Extensions.csproj", "{2DD3CB7D-462E-4039-B684-81B1E88C7C6A}"
3337
EndProject
3438
Global
3539
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -73,14 +77,22 @@ Global
7377
{CA63CC7B-BE27-4737-AE91-42E43F729A1E}.Debug|Any CPU.Build.0 = Debug|Any CPU
7478
{CA63CC7B-BE27-4737-AE91-42E43F729A1E}.Release|Any CPU.ActiveCfg = Release|Any CPU
7579
{CA63CC7B-BE27-4737-AE91-42E43F729A1E}.Release|Any CPU.Build.0 = Release|Any CPU
76-
{81019B1A-C554-44BA-A9EF-6BE6A223AD20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
77-
{81019B1A-C554-44BA-A9EF-6BE6A223AD20}.Debug|Any CPU.Build.0 = Debug|Any CPU
78-
{81019B1A-C554-44BA-A9EF-6BE6A223AD20}.Release|Any CPU.ActiveCfg = Release|Any CPU
79-
{81019B1A-C554-44BA-A9EF-6BE6A223AD20}.Release|Any CPU.Build.0 = Release|Any CPU
8080
{83319150-92D2-408C-A944-52DBE6AB8B37}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
8181
{83319150-92D2-408C-A944-52DBE6AB8B37}.Debug|Any CPU.Build.0 = Debug|Any CPU
8282
{83319150-92D2-408C-A944-52DBE6AB8B37}.Release|Any CPU.ActiveCfg = Release|Any CPU
8383
{83319150-92D2-408C-A944-52DBE6AB8B37}.Release|Any CPU.Build.0 = Release|Any CPU
84+
{8F112368-2E45-4C3A-922E-85AB6056F559}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
85+
{8F112368-2E45-4C3A-922E-85AB6056F559}.Debug|Any CPU.Build.0 = Debug|Any CPU
86+
{8F112368-2E45-4C3A-922E-85AB6056F559}.Release|Any CPU.ActiveCfg = Release|Any CPU
87+
{8F112368-2E45-4C3A-922E-85AB6056F559}.Release|Any CPU.Build.0 = Release|Any CPU
88+
{E18F8C70-7448-4039-9D78-1369D7F498EF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
89+
{E18F8C70-7448-4039-9D78-1369D7F498EF}.Debug|Any CPU.Build.0 = Debug|Any CPU
90+
{E18F8C70-7448-4039-9D78-1369D7F498EF}.Release|Any CPU.ActiveCfg = Release|Any CPU
91+
{E18F8C70-7448-4039-9D78-1369D7F498EF}.Release|Any CPU.Build.0 = Release|Any CPU
92+
{2DD3CB7D-462E-4039-B684-81B1E88C7C6A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
93+
{2DD3CB7D-462E-4039-B684-81B1E88C7C6A}.Debug|Any CPU.Build.0 = Debug|Any CPU
94+
{2DD3CB7D-462E-4039-B684-81B1E88C7C6A}.Release|Any CPU.ActiveCfg = Release|Any CPU
95+
{2DD3CB7D-462E-4039-B684-81B1E88C7C6A}.Release|Any CPU.Build.0 = Release|Any CPU
8496
EndGlobalSection
8597
GlobalSection(SolutionProperties) = preSolution
8698
HideSolutionNode = FALSE
@@ -95,8 +107,10 @@ Global
95107
{2FAECDE3-8D21-4C36-BFF1-3F7C1A56F0D4} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
96108
{C360A0D5-1671-4738-BC5D-BED0E8A24D66} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
97109
{CA63CC7B-BE27-4737-AE91-42E43F729A1E} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
98-
{81019B1A-C554-44BA-A9EF-6BE6A223AD20} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
99110
{83319150-92D2-408C-A944-52DBE6AB8B37} = {0BC0CC4E-A0F1-45E8-B41A-AE0FA76BF3E5}
111+
{8F112368-2E45-4C3A-922E-85AB6056F559} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
112+
{E18F8C70-7448-4039-9D78-1369D7F498EF} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
113+
{2DD3CB7D-462E-4039-B684-81B1E88C7C6A} = {588205D4-3A30-4DA4-849D-C7422C396DAA}
100114
EndGlobalSection
101115
GlobalSection(ExtensibilityGlobals) = postSolution
102116
SolutionGuid = {B3166EDE-037B-4C68-BEBA-5DE9C5E3DB82}

docs/Configure-Azure-Deploy.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ Last step before deploy - we need to update `src/Skoruba.IdentityServer4.STS.Ide
7979
}
8080
```
8181

82-
In `Helpers/IdentityServerBuilderExtensions.cs` - change loading certificates from `StoreLocation.LocalMachine` to `StoreLocation.CurrentUser`.
82+
In `src/Skoruba.IdentityServer4.STS.Identity/Helpers/IdentityServerBuilderExtensions.cs` - change loading certificates from `StoreLocation.LocalMachine` to `StoreLocation.CurrentUser`.
83+
84+
And change in method: `AddCustomSigningCredential`
85+
from:
86+
```
87+
var certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, certificateConfiguration.SigningCertificateThumbprint, true);
88+
```
89+
to:
90+
```
91+
var certCollection = certStore.Certificates.Find(X509FindType.FindByThumbprint, certificateConfiguration.SigningCertificateThumbprint, false);
92+
```
93+
8394

8495
Now we can (re)deploy both apps to Azure.

docs/Images/Admin-Swagger-UI.PNG

63.2 KB
Loading
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using Skoruba.IdentityServer4.Admin.Api.Configuration.Constants;
2+
3+
namespace Skoruba.IdentityServer4.Admin.Api.Configuration
4+
{
5+
public class AdminApiConfiguration
6+
{
7+
public string IdentityServerBaseUrl { get; set; } = AuthorizationConsts.IdentityServerBaseUrl;
8+
9+
public string OidcSwaggerUIClientId { get; set; } = AuthorizationConsts.OidcSwaggerUIClientId;
10+
11+
public string OidcApiName { get; set; } = AuthorizationConsts.OidcApiName;
12+
}
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Microsoft.AspNetCore.Mvc.ApplicationModels;
2+
3+
namespace Skoruba.IdentityServer4.Admin.Api.Configuration.ApplicationParts
4+
{
5+
public class GenericControllerRouteConvention : IControllerModelConvention
6+
{
7+
public void Apply(ControllerModel controller)
8+
{
9+
if (controller.ControllerType.IsGenericType)
10+
{
11+
// this change is required because some of the controllers have generic parameters
12+
// and require resolution that will remove arity from the type
13+
// as well as remove the 'Controller' at the end of string
14+
15+
var name = controller.ControllerType.Name;
16+
var nameWithoutArity = name.Substring(0, name.IndexOf('`'));
17+
controller.ControllerName = nameWithoutArity.Substring(0, nameWithoutArity.LastIndexOf("Controller"));
18+
}
19+
}
20+
}
21+
}

0 commit comments

Comments
 (0)