felsokning
Help. Broken Rust plugin
You're - literally - going to have to reverse-engineer what was done in BasePlayer class, to understand the required overloads. See here: https://oxidemod.org/threads/where-is-the-baseplayer-class.22597/
15 replies
✅ Trouble porting to AOT JSON
Even then, you can do something like
GoogleUser: User
and AADUser: User
and OtherProvider: User
. Which makes User extensible and the target type derived from that. So, if you want to change DisplayName
, for example, you just have to change it in User
, once, not 50 different User
classes.49 replies
✅ Trouble porting to AOT JSON
If you have 1 User class with properties that get populated per domain type, those null/empties can be ignored; you can project one to many, instead of having to have 1:1. Unless you're projecting the User back to the client, the client doesn't care how you process
User
.49 replies
✅ Trouble porting to AOT JSON
In short, no.
https://github.com/dotnet/runtime/issues/58198
https://github.com/dotnet/runtime/issues/58938
49 replies
✅ Trouble porting to AOT JSON
I think, without being able to see the code, it's resolving as multiple types; so it's resolving as
A
and B
or A
and C
. If you want do it based on specific properties, you can, but I've never done it - so I can't expound upon it, further.
https://learn.microsoft.com/en-us/dotnet/standard/serialization/system-text-json/polymorphism?pivots=dotnet-8-0#configure-polymorphism-with-the-contract-model49 replies
✅ Trouble porting to AOT JSON
Ah, if they share the same name, you can add the flag to ignore them writing
default
or null
. https://learn.microsoft.com/en-us/dotnet/api/system.text.json.serialization.jsonignorecondition?view=net-8.0#fields49 replies
✅ Trouble porting to AOT JSON
Your example, they all have the same name, so if everyone inherites from
Nested
they would all have the same properties and methods derived from Nested
. If it's Nested1
and Nested2
and Nested3
and... Then I don't think there's a "quick fix" for that.49 replies
✅ Trouble porting to AOT JSON
Inheritance.
public class A: Nested {}
public class B: Nested {}
https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/tutorials/inheritance#background-what-is-inheritance49 replies
Passing an array as a parameter to an event
I'm 99.999% sure MSFT hired James Newton-King (the guy who wrote Newtonsoft.Json), so - as @Buddy said, you should move to using
System.Text.Json
.
So, server-side would be JsonSerializer.Serialize(obj)
and client-side would be JsonSerializer.Deserialize<ObjType>(objString)
.45 replies
What is the simplest way to safely manage client backend calls and sensitive data in Razor Pages?
Make a backend call to save changes, which I believe would require both the document ID and textarea content on the front end so the method knows which document is being saved.
If your UI and API are truly separated, you could use JS to do a GET
on the API, first, and have it return the list of documents. If you're worried about permissions and/or who should be able to access what document, you could implement rbac (via opal) and have your API reference that to validate who should have access to what.
Decide where to store the document ID for safe access on the front-end PageView so I can use it in a fetch call
As eluded to in my first blurb, you should only "store" it after the first GET
call; as for "where" to store it, not sure.
Specifically, what kind of sensitive data should be on the front end to make a secure backend API call,
Basically, all you need is the JWT (assuming you're using something like MSAL).
If you have a true separation of concerns, you can put something between the UI and API to validate that your calls came from a valid/trusted source; for example, if you're using Azure, you could put APIM in-between the UI and the API and have APIM include an origin-validation
header value that your API processes (APIM can validate the JWT).
So, for example, the UI generates a request, then sends it to the vanity name of your API. APIM is set to receive the requests on that name. It receives the request, validates the JWT, and creates a secure header (e.g.: X-Origin-Validation
) using an encryption key stored in Azure Key Vault and then forwards the entire request to your API (including the header it just created). Your API, upon receiving the request, first checks the X-Origin-Validation
header (using the same encryption key from Azure Key Vault) and continues processing the request, if the validation passes; otherwise, it should throw and not continue the request.
https://github.com/Azure/api-management-policy-snippets5 replies
Setting Machine Key in new .NET Core applications
I'm assuming MachineKey contains the encryption key[s] used to encrypt/decrypt?
I think it'll be the same underlying key mechanism for
File.Encrypt
. https://learn.microsoft.com/en-us/dotnet/api/system.io.file.encrypt?view=net-8.0#remarks
Basically, you'll need the original keys from the CSP (Cryptographic Service Provider). Even though you'll provide the same key identifier, unless you're using the same exact machine, the actual encryption keys will be different; so, you may have to export/import them - depending on your scenario.3 replies