using Elsa.Identity.Contracts;
using Elsa.Identity.Entities;
using Elsa.Identity.Models;
// ReSharper disable once CheckNamespace
namespace Elsa.Extensions;
///
/// Provides extensions for .
///
public static class ApplicationProviderExtensions
{
///
/// Finds the application with the specified client ID.
///
/// The user provider.
/// The client ID to search by.
/// Whether to bypass tenant scoping when resolving the application.
/// The cancellation token.
/// The application with the specified client ID.
public static async Task FindByClientIdAsync(this IApplicationProvider applicationProvider, string clientId, bool tenantAgnostic = false, CancellationToken cancellationToken = default)
{
var filter = new ApplicationFilter
{
ClientId = clientId,
TenantAgnostic = tenantAgnostic
};
return await applicationProvider.FindAsync(filter, cancellationToken);
}
}