skoruba / Duende.IdentityServer.Admin

The administration for the Duende IdentityServer and Asp.Net Core Identity ⚡
Apache License 2.0
588 stars 200 forks source link

Incorrect id return after post properties to client in Admin API #148

Open gekiss opened 1 year ago

gekiss commented 1 year ago

Describe the bug

Adding client property through admin API, POST api/Clients/{id}/Properties

https://github.com/skoruba/Duende.IdentityServer.Admin/blob/724a318e80f710d13a457088887b94ace24e7dec/src/Skoruba.Duende.IdentityServer.Admin.Api/Controllers/ClientsController.cs#L174

expected that method return newly added property id, but method always return value id equal 1

To Reproduce

Create client POST api/Clients

then add property to existing client POST api/Clients/{id}/Properties

Explanation

IMHO the method AddClientPropertyAsync must be return clientProperty.Id instead of function AutoSaveChangesAsync result https://github.com/skoruba/Duende.IdentityServer.Admin/blob/724a318e80f710d13a457088887b94ace24e7dec/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Repositories/ClientRepository.cs#L190

like the method AddClientAsync https://github.com/skoruba/Duende.IdentityServer.Admin/blob/724a318e80f710d13a457088887b94ace24e7dec/src/Skoruba.Duende.IdentityServer.Admin.EntityFramework/Repositories/ClientRepository.cs#L320

The same behavior when add claim to client

Thanks for your work.

georgehastingsopusenergy commented 5 months ago

Hi this also is an issue with Claims and likely Secrets.

skoruba commented 5 months ago

@georgehastingsopusenergy - thank you for letting me know. can you please send a PR?