Context: I have an Azure Storage Account with a private blob container. In this container I have a root schema stored together with child schemas that are referenced by the root schema.
Goal: My goal is to access the schemas in the private container and resolve them using JSchemaUrlResolver from Newtonsoft JSON.NET Schema and an identity (user identity / managed identity).
Problem: I can't use SAS URIs. I.e. I have to use the "normal" Blob URI without any additional parameters. In my .NET Core application I can retrieve an Azure Credential and in this context also a token. But JSchemaUrlResolver only supports System.Net ICredential with Basic auth and I don't see an option to use the token respectively the Azure Credential to authenticate.
Question: Is there a way (except for downloading the file e.g. using the SDK) to get and resolve the schemas stored in the private Blob container given the context described above?
CodePudding user response:
You will need to implement your own JSchemaResolver
that is able to download files from your blob storage account.
See https://github.com/JamesNK/Newtonsoft.Json.Schema/blob/e00fb27edd710a4e4270c08b607143d15bc67c84/Src/Newtonsoft.Json.Schema/JSchemaUrlResolver.cs for an example of how a JSchemaResolver
is implemented.