Annabelle
Annabelle
CC#
Created by Annabelle on 3/16/2025 in #help
JWT still validates token if present in headers even for un-protected route
I think OnAuthenticationFailed was not meant for the usecase I wanted and seemed to fire more than the other one as it always validates
7 replies
CC#
Created by Annabelle on 3/16/2025 in #help
JWT still validates token if present in headers even for un-protected route
Which solves the issue, and it no longer behaves. That way, it will only validate token on protected routes
7 replies
CC#
Created by Annabelle on 3/16/2025 in #help
JWT still validates token if present in headers even for un-protected route
In the end, I just kept OnChallenge and removed OnAuthenticationFailed
7 replies
CC#
Created by Annabelle on 3/16/2025 in #help
JWT still validates token if present in headers even for un-protected route
I tried that also removing token out of context
7 replies
CC#
Created by Annabelle on 3/16/2025 in #help
JWT still validates token if present in headers even for un-protected route
Seems solution is just removing OnAuthenticationFailed and keeping OnChallenge
7 replies
CC#
Created by Annabelle on 2/17/2025 in #help
BsonDocument exceeds the JsonSerializerOptions.MaxDepth setting
No description
5 replies
CC#
Created by Annabelle on 2/17/2025 in #help
BsonDocument exceeds the JsonSerializerOptions.MaxDepth setting
No description
5 replies
CC#
Created by Annabelle on 2/17/2025 in #help
BsonDocument exceeds the JsonSerializerOptions.MaxDepth setting
Ok - so I found a solution that works now. Create new class BsonJsonConverter
public class BsonJsonConverter : JsonConverter<BsonDocument>
{
public override BsonDocument? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return BsonDocument.Parse(reader.GetString());
}

public override void Write(Utf8JsonWriter writer, BsonDocument value, JsonSerializerOptions options)
{
writer.WriteRawValue(value.ToJson());
}
}
public class BsonJsonConverter : JsonConverter<BsonDocument>
{
public override BsonDocument? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return BsonDocument.Parse(reader.GetString());
}

public override void Write(Utf8JsonWriter writer, BsonDocument value, JsonSerializerOptions options)
{
writer.WriteRawValue(value.ToJson());
}
}
change where BsonDocument is to this
[BsonElement("schema")]
[JsonConverter(typeof(BsonJsonConverter))]
public required BsonDocument Schema { get; set; }
[BsonElement("schema")]
[JsonConverter(typeof(BsonJsonConverter))]
public required BsonDocument Schema { get; set; }
and in your Program.cs of your API add this
builder.Services.Configure<JsonOptions>(o =>
{
o.SerializerOptions.MaxDepth = 256;
o.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
o.SerializerOptions.Converters.Add(new BsonJsonConverter());
});
builder.Services.Configure<JsonOptions>(o =>
{
o.SerializerOptions.MaxDepth = 256;
o.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles;
o.SerializerOptions.Converters.Add(new BsonJsonConverter());
});
5 replies
CC#
Created by Annabelle on 2/17/2025 in #help
BsonDocument exceeds the JsonSerializerOptions.MaxDepth setting
This is related to openapi when trying to access it:
[11:11:33 ERR] HTTP GET /openapi/v1.json responded 500 in 269.2645 ms <s:Serilog.AspNetCore.RequestLoggingMiddleware>
[11:11:33 ERR] HTTP GET /openapi/v1.json responded 500 in 269.2645 ms <s:Serilog.AspNetCore.RequestLoggingMiddleware>
5 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
not sure if possible with compose I know you can with 1 dockerfile
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
nginx yeah not needed
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
But I would to react/c#
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
what do you think ?
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
but idk how to setup debug env with docker compose
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
maybe with docker
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
harder to setup on windows
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
Thank you for your help
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
But for dev I need some way to test it out
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
Yeah in prod I think I'll use nginx ingress
17 replies
CC#
Created by Annabelle on 11/25/2023 in #help
Ocelot/Yarp a valid use-case for the following react/asp.net?
Did you encounter any issues or it was reletevly simple
17 replies