Skip to content

Commit

Permalink
chore: add debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
tnotheis committed Jan 10, 2025
1 parent a545cfe commit d7124fa
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using OpenIddict.Core;
using OpenIddict.Validation.AspNetCore;

Expand All @@ -29,12 +30,15 @@ namespace Backbone.Modules.Devices.ConsumerApi.Controllers;
public class IdentitiesController : ApiControllerBase
{
private readonly OpenIddictApplicationManager<CustomOpenIddictEntityFrameworkCoreApplication> _applicationManager;
private readonly ILogger<IdentitiesController> _logger;

public IdentitiesController(
IMediator mediator,
OpenIddictApplicationManager<CustomOpenIddictEntityFrameworkCoreApplication> applicationManager) : base(mediator)
OpenIddictApplicationManager<CustomOpenIddictEntityFrameworkCoreApplication> applicationManager,
ILogger<IdentitiesController> logger) : base(mediator)
{
_applicationManager = applicationManager;
_logger = logger;
}

[HttpPost]
Expand All @@ -45,6 +49,14 @@ public async Task<IActionResult> CreateIdentity(CreateIdentityRequest request, C
{
var client = await _applicationManager.FindByClientIdAsync(request.ClientId, cancellationToken);

var clients = await _applicationManager.ListAsync(cancellationToken: cancellationToken).ToListAsync(cancellationToken);

_logger.LogInformation("NUMBER OF CLIENTS: {NumberOfClients}", clients.Count);
foreach (var clientItem in clients)
{
_logger.LogInformation("Client: {ClientId}", clientItem.ClientId);
}

if (client == null || !await _applicationManager.ValidateClientSecretAsync(client, request.ClientSecret, cancellationToken))
throw new OperationFailedException(GenericApplicationErrors.Unauthorized());

Expand Down

0 comments on commit d7124fa

Please sign in to comment.