Skip to content

Instantly share code, notes, and snippets.

"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning",
"Microsoft.AspNetCore.Authentication": "Debug",
"Microsoft.AspNetCore.Authorization": "Debug"
}
},
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.Text;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.IdentityModel.Logging;
public class Program
{
public static void Main(string[] args)
{
// add it at the beginnning
IdentityModelEventSource.ShowPII = true;
IdentityModelEventSource.LogCompleteSecurityArtifact = true;
<rewrite>
<outboundRules>
<rule name="Replace RESPONSE_Content_Security_Policy" patternSyntax="ECMAScript" stopProcessing="true">
<match serverVariable="RESPONSE_Content-Security-Policy" pattern=".*viewfile.*" />
<action type="Rewrite" value="default-src 'none';" />
</rule>
</outboundRules>
</rewrite>
[HttpPost]
public async Task<IActionResult> Token(OpenIdConnectRequest request)
{
if (!request.IsPasswordGrantType())
{
// Return bad request if the request is not for password grant type
return BadRequest(new OpenIdConnectResponse
{
Error = OpenIdConnectConstants.Errors.UnsupportedGrantType,
ErrorDescription = "The specified grant type is not supported."
using Microsoft.AspNetCore.Mvc;
using OpenIddict.Abstractions;
using OpenIddict.Server;
namespace WebApplication12.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class TokenController : ControllerBase
{
builder.WebHost.ConfigureKestrel(options =>
{
options.ConfigureHttpsDefaults(httpsOptions =>
{
httpsOptions.SslProtocols = System.Security.Authentication.SslProtocols.Tls12;
});
});
builder.Services.AddBusConsume(config =>
{
config.ReceiveEndpoint("your-queue-name", e =>
{
e.Consumer<CreateOrderConsumer>();
});
});
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
// Explicitly allow OPTIONS requests for CORS preflight
endpoints.MapMethods("{*path}", new[] { "OPTIONS" }, async context =>
{
context.Response.StatusCode = 200;
await context.Response.CompleteAsync();
});
public async Task<List<FileNode>> SearchTreeNodesAsync(List<FileNode> nodes, string searchTerm, List<string> debugMessages)
{
debugMessages.Clear();
debugMessages.Add($"Début de la recherche pour le terme : {searchTerm}");
if (string.IsNullOrWhiteSpace(searchTerm))
{
debugMessages.Add("Le terme de recherche est vide, retour de tous les nœuds.");
return nodes;
}