Skip to content
This repository was archived by the owner on Aug 1, 2021. It is now read-only.

Commit 349c7b8

Browse files
committed
fonts to assets
device-flow component
1 parent 1b45b7b commit 349c7b8

File tree

110 files changed

+10265
-2208
lines changed

Some content is hidden

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

110 files changed

+10265
-2208
lines changed

CHANGELOG.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
## v1.1.0
22

3+
* Now you can run through a docker! ❤️
4+
* Unfortunately you need to change hosts for it. Because Authority URL. I can't do anything to face it. It's security feature from OAuth2 to keep same Authority name for each Token.
5+
6+
7+
* Update of main Context, JpProject
8+
* Removed previous components from MySql.Migrations and Sql.Migrations. Unified in same project.
9+
10+
* Client Page:
11+
* Changed Claims button to be under Token - Following Docs from [IdentityServer4](https://identityserver4.readthedocs.io/en/latest/reference/client.html#token)
12+
* Included Device Flow options
13+
314
Updates:
415
* @angular/cli to 7.3.6
516
* @angular/core to 7.2.10 (ng update @angular/core, then it updated other dep's)|
@@ -46,30 +57,16 @@ Updated components from UI:
4657
|ngx-infinite-scroll| 0.8.4| → 7.1.0|
4758
|popper.js| 1.14.3| → 1.14.7|
4859
|screenfull| 3.3.2| → 4.1.0|
49-
|source-sans-pro| 2.20.2| → 2.45.0|
5060
|summernote| 0.8.10| → 0.8.11|
5161
|sweetalert| 1.1.3| → 2.1.2|
52-
|ts-helpers| 1.1.1| → 1.1.2|
62+
|ts-helpers| 1.1.1| **removed**|
5363
|web-animations-js| 2.2.1| → 2.3.1|
5464
|zone.js| 0.8.29| → 0.9.0|
5565
|@angular-devkit/build-angular| 0.6.1| → 0.13.6|
56-
|@types/codemirror| 0.0.56| → 0.0.72|
57-
|@types/jasmine| 2.8.6| → 3.3.12|
58-
|@types/jasminewd2| 2.0.3| → 2.0.6|
5966
|@types/lodash| 4.14.108| → 4.14.123|
60-
|@types/node| 8.9.4| → 11.11.7|
6167
|codelyzer| 4.2.1| → 5.0.0-beta.2|
62-
|jasmine-core| 2.99.1| → 3.3.0|
63-
|karma| 1.7.1| → 4.0.1|
64-
|karma-cli| 1.0.1| → 2.0.0|
65-
|karma-coverage-istanbul-reporter| 1.4.2| → 2.0.5|
66-
|karma-jasmine| 1.1.1| → 2.0.1|
67-
|karma-jasmine-html-reporter| 0.2.2| → 1.4.0|
68-
|protractor| 5.3.0| → 6.0.0|
6968
|ts-node| 5.0.1| → 8.0.3|
7069
|tslint| 5.9.1| → 5.14.0|
71-
|typescript| 3.2.4| → 3.3.4000|
72-
|webdriver-manager| 10.2.5| → 13.0.0|
7370

7471
## v1.0.0
7572

src/Backend/Jp.Domain/CommandHandlers/ClientCommandHandler.cs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ public async Task Handle(UpdateClientCommand request, CancellationToken cancella
7777
return;
7878
}
7979

80-
// Businness logic here
8180
var savedClient = await _clientRepository.GetClient(request.Client.ClientId);
8281
if (savedClient == null)
8382
{
@@ -291,9 +290,7 @@ public async Task Handle(SaveClientCommand request, CancellationToken cancellati
291290
return;
292291
}
293292

294-
PrepareClientTypeForNewClient(request);
295-
var client = request.Client.ToEntity();
296-
client.Description = request.Description;
293+
var client = request.ToEntity();
297294

298295
_clientRepository.Add(client);
299296

@@ -303,33 +300,7 @@ public async Task Handle(SaveClientCommand request, CancellationToken cancellati
303300
}
304301
}
305302

306-
private void PrepareClientTypeForNewClient(SaveClientCommand command)
307-
{
308-
switch (command.ClientType)
309-
{
310-
case ClientType.Empty:
311-
break;
312-
case ClientType.WebImplicit:
313-
command.Client.AllowedGrantTypes = GrantTypes.Implicit;
314-
command.Client.AllowAccessTokensViaBrowser = true;
315-
break;
316-
case ClientType.WebHybrid:
317-
command.Client.AllowedGrantTypes = GrantTypes.Hybrid;
318-
break;
319-
case ClientType.Spa:
320-
command.Client.AllowedGrantTypes = GrantTypes.Implicit;
321-
command.Client.AllowAccessTokensViaBrowser = true;
322-
break;
323-
case ClientType.Native:
324-
command.Client.AllowedGrantTypes = GrantTypes.Hybrid;
325-
break;
326-
case ClientType.Machine:
327-
command.Client.AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials;
328-
break;
329-
default:
330-
throw new ArgumentOutOfRangeException();
331-
}
332-
}
303+
333304

334305
public async Task Handle(CopyClientCommand request, CancellationToken cancellationToken)
335306
{

src/Backend/Jp.Domain/Commands/Client/ClientType.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ public enum ClientType
77
WebHybrid = 2,
88
Spa = 3,
99
Native = 4,
10-
Machine = 5
10+
Machine = 5,
11+
Device=6
1112
}
1213
}

src/Backend/Jp.Domain/Commands/Client/SaveClientCommand.cs

Lines changed: 77 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
using IdentityServer4.EntityFramework.Mappers;
2+
using IdentityServer4.Models;
13
using Jp.Domain.Validations.Client;
4+
using System;
25

36
namespace Jp.Domain.Commands.Client
47
{
58
public class SaveClientCommand : ClientCommand
69
{
7-
public string Description { get; }
810
public ClientType ClientType { get; }
911

1012
public SaveClientCommand(string clientId, string name, string clientUri, string logoUri, string description, ClientType clientType)
@@ -15,14 +17,87 @@ public SaveClientCommand(string clientId, string name, string clientUri, string
1517
ClientName = name,
1618
ClientUri = clientUri,
1719
LogoUri = logoUri,
20+
Description = description,
1821
};
19-
Description = description;
2022
ClientType = clientType;
2123
}
24+
25+
public IdentityServer4.EntityFramework.Entities.Client ToEntity()
26+
{
27+
PrepareClientTypeForNewClient();
28+
return Client.ToEntity();
29+
}
30+
31+
private void PrepareClientTypeForNewClient()
32+
{
33+
switch (ClientType)
34+
{
35+
case ClientType.Empty:
36+
break;
37+
case ClientType.Device:
38+
ConfigureDevice();
39+
break;
40+
case ClientType.WebImplicit:
41+
ConfigureWebImplicit();
42+
43+
break;
44+
case ClientType.WebHybrid:
45+
ConfigureWebHybrid();
46+
break;
47+
case ClientType.Spa:
48+
ConfigureSpa();
49+
break;
50+
case ClientType.Native:
51+
ConfigureNative();
52+
53+
break;
54+
case ClientType.Machine:
55+
ConfigureMachine();
56+
57+
break;
58+
default:
59+
throw new ArgumentOutOfRangeException();
60+
}
61+
}
62+
2263
public override bool IsValid()
2364
{
2465
ValidationResult = new SaveClientCommandValidation().Validate(this);
2566
return ValidationResult.IsValid;
2667
}
68+
69+
private void ConfigureDevice()
70+
{
71+
Client.AllowedGrantTypes = GrantTypes.DeviceFlow;
72+
Client.RequireClientSecret = false;
73+
Client.AllowOfflineAccess = true;
74+
}
75+
76+
private void ConfigureWebImplicit()
77+
{
78+
Client.AllowedGrantTypes = GrantTypes.Implicit;
79+
Client.AllowAccessTokensViaBrowser = true;
80+
}
81+
82+
private void ConfigureWebHybrid()
83+
{
84+
Client.AllowedGrantTypes = GrantTypes.Hybrid;
85+
}
86+
87+
private void ConfigureSpa()
88+
{
89+
Client.AllowedGrantTypes = GrantTypes.Implicit;
90+
Client.AllowAccessTokensViaBrowser = true;
91+
}
92+
93+
private void ConfigureNative()
94+
{
95+
Client.AllowedGrantTypes = GrantTypes.Hybrid;
96+
}
97+
98+
private void ConfigureMachine()
99+
{
100+
Client.AllowedGrantTypes = GrantTypes.ResourceOwnerPasswordAndClientCredentials;
101+
}
27102
}
28103
}

src/Backend/Jp.UserManagement/Controllers/ClientController.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,7 @@ public async Task<ActionResult<DefaultResponse<bool>>> Save([FromBody] SaveClien
4646
return Response(true);
4747
}
4848

49-
[HttpPost, Route("update"), Authorize(Policy = "Admin")
50-
]
49+
[HttpPost, Route("update"), Authorize(Policy = "Admin")]
5150
public async Task<ActionResult<DefaultResponse<bool>>> Update([FromBody] Client client)
5251
{
5352
if (!ModelState.IsValid)

0 commit comments

Comments
 (0)