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

Commit 81fe855

Browse files
committed
night build
1 parent 2b20d54 commit 81fe855

82 files changed

Lines changed: 15332 additions & 1582 deletions

File tree

Some content is hidden

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

src/Backend/Jp.Application/AutoMapper/ViewModelToDomainMappingProfile.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ public ViewModelToDomainMappingProfile()
3737
* Client commands
3838
*/
3939
CreateMap<Client, UpdateClientCommand>().ConstructUsing(c => new UpdateClientCommand(c));
40-
CreateMap<ClientViewModel, Client>(MemberList.Destination);
4140
}
4241
}
4342
}

src/Backend/Jp.Application/Interfaces/IClientAppService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ public interface IClientAppService: IDisposable
1111
Task<IEnumerable<ClientListViewModel>> GetClients();
1212
Task<Client> GetClientDetails(string clientId);
1313
Task Update(Client client);
14+
Task<IEnumerable<Secret>> GetSecrets(string clientId);
1415
}
1516
}

src/Backend/Jp.Application/Services/ClientAppService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public Task<IEnumerable<ClientListViewModel>> GetClients()
4040
public async Task<Client> GetClientDetails(string clientId)
4141
{
4242
var resultado = await _clientRepository.GetByUniqueName(clientId);
43-
return resultado.ToModel();
43+
return _mapper.Map<Client>(resultado);
4444
}
4545

4646
public Task Update(Client client)
@@ -49,6 +49,11 @@ public Task Update(Client client)
4949
return Bus.SendCommand(registerCommand);
5050
}
5151

52+
public async Task<IEnumerable<Secret>> GetSecrets(string clientId)
53+
{
54+
return _mapper.Map<IEnumerable<Secret>>(await _clientRepository.GetSecrets(clientId));
55+
}
56+
5257

5358
public void Dispose()
5459
{
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using IdentityServer4.EntityFramework.Entities;
5+
6+
namespace Jp.Application.ViewModels.ClientsViewModels
7+
{
8+
public class ClientClaimViewModel
9+
{
10+
public ClientClaimViewModel() { }
11+
public ClientClaimViewModel(string type, string value)
12+
{
13+
Type = type;
14+
Value = value;
15+
}
16+
17+
public int Id { get; set; }
18+
public string Type { get; set; }
19+
public string Value { get; set; }
20+
}
21+
}

src/Backend/Jp.Application/ViewModels/ClientsViewModels/ClientViewModel.cs

Lines changed: 0 additions & 96 deletions
This file was deleted.
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System.Threading.Tasks;
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
using System.Threading.Tasks;
24
using IdentityServer4.EntityFramework.Entities;
35

46
namespace Jp.Domain.Interfaces
@@ -7,5 +9,6 @@ public interface IClientRepository : IRepository<Client>
79
{
810
Task<Client> GetByUniqueName(string clientId);
911
Task UpdateWithChildrens(Client client);
12+
Task<List<ClientSecret>> GetSecrets(string clientId);
1013
}
1114
}

src/Backend/Jp.Infra.Data/Repository/ClientRepository.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using System.Linq;
1+
using System.Collections.Generic;
2+
using System.Linq;
23
using System.Threading.Tasks;
34
using IdentityServer4.EntityFramework.Entities;
45
using Jp.Domain.Interfaces;
@@ -36,6 +37,14 @@ public async Task UpdateWithChildrens(Client client)
3637
Update(client);
3738
}
3839

40+
public async Task<List<ClientSecret>> GetSecrets(string clientId)
41+
{
42+
var client = await DbSet.Include(a => a.ClientSecrets).Where(w => w.ClientId == clientId)
43+
.SingleOrDefaultAsync();
44+
return client.ClientSecrets;
45+
46+
}
47+
3948

4049
private async Task RemoveClientRelationsAsync(Client client)
4150
{

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using System.Threading.Tasks;
3+
using IdentityServer4.EntityFramework.Mappers;
34
using IdentityServer4.Models;
45
using Jp.Application.Interfaces;
56
using Jp.Application.ViewModels.ClientsViewModels;
@@ -40,9 +41,17 @@ public async Task<ActionResult<DefaultResponse<Client>>> Details(string clientId
4041
return Response(clients);
4142
}
4243

44+
[HttpGet, Route("secrets")]
45+
public async Task<ActionResult<DefaultResponse<IEnumerable<Secret>>>> Secrets(string clientId)
46+
{
47+
var clients = await _clientAppService.GetSecrets(clientId);
48+
return Response(clients);
49+
}
50+
4351
[HttpPost, Route("update")]
4452
public async Task<ActionResult<DefaultResponse<bool>>> Update([FromBody] Client client)
4553
{
54+
var teste = client.ToEntity();
4655
if (!ModelState.IsValid)
4756
{
4857
NotifyModelStateErrors();

0 commit comments

Comments
 (0)