I am looking for Fhir Resource validation against Fhir Structure definition - validation

I am looking for Fhir Resource validation against Fhir Structure definition using .net core
I found there is a lib org.hl7.fhir.validator.jar and I couldn't find a better way to do validation through c# code, my requirements are simple
Cardinality validation
Values
Bindings
Profiles
I have an idea in my mind, which is passing the FhirResource as a parameter and load the structure definition file and check the properties and return the error messages as Operational Outcome. Can someone advise me a best way to try it in C# specially in .NET core?

You can use the validation functionality of the .NET FHIR API (https://www.nuget.org/packages/Hl7.Fhir.STU3/), see here (https://github.com/FirelyTeam/Furore.Fhir.ValidationDemo) for a demo application that uses this library.
Although the demo is a winforms project, the .NET FHIR API is fully .NET Core compatible.

Related

ABAC support for Spring Security or Apache Shiro

I'm trying to find any open-source or commercial implementation of Attribute-Based Access Control(ABAC) paradigm that will work together with Spring Security or Apache Shiro frameworks. Right now I can't find any of them.
I don't think I'm a first one who needs such kind of functionality - so could you please recommend frameworks that will support this ?
Also, can Permissions in Apache Shiro be considered as a particular case of ABAC paradigm implementation ?
jCasbin is a powerful and efficient open-source access control library for Java projects. It provides support for enforcing authorization based on various access control models. ABAC is one of the models that is supported by jCasbin.
ABAC: syntax sugar like a resource. The owner can be used to get the attribute for the resource.
In jCasbin, an access control model is abstracted into a CONF file based on the PERM metamodel (Policy, Effect, Request, Matches). So switching or upgrading the authorization mechanism for a project is just as simple as modifying a configuration. You can customize your own access control model by combining the available models. For example, you can get RBAC roles and ABAC attributes together inside one model and share one set of policy rules.
It supports Spring boot via plugin: jcasbinspring-boott-plugin
Also, there is another opensource project called EasyAback. (The original project documents are written in Russian and I translated them and moreover added some other documents and diagram link)
This github sample shows how ABAC can be implemented on top of spring-security framework using Spring Expression Language (SPEL). An excellent blog describes the sample code using a simple web app. Having come from an XACML background I found this project to be very familiar to XACML. It essentially maps XACML concepts to define policy's in JSON (instead of XACML / XML) and using a familiar spring-security API and framework.
Disclaimer: I work for Axiomatics
Axiomatics provides an Attribute Based Access Control (ABAC) implementation that integrates with different environments:
Native Spring Security integration
integration with other Java apps via our SDK and API
integration with API gateways e.g. Apigee
database security
We have had customers integrate with Apache Shiro . Apache Shiro are a simplified form of ABAC. They can be integrated with ABAC.
Axiomatics' implementation relies on XACML.
For an open source Java alternative, you can find several on the XACML Wikipedia page: AuthzForce, Apache OpenAZ, WSO2 Balana. For AuthzForce, you can find Java code samples of ABAC/XACML authorization filters using either an embedded Java PDP or a (remote) RESTful PDP.

Where to create model when using Web API

I've been checking quite a few examples related to Web Api, and they all create the model in the Models folder contained with the Web Api project but I'm curious as to how this should be handled if you want to use/re-use these models with various projects.
In the past, when using WCF REST, I would have created the following:
Business Model Project (PCL)
Business Layer Project
Data Layer Project
SQL Data Layer Project
WCF REST Project
Web App
Windows App
Third-Party Web app (javascript)
Mobile App (Xamarin)
Projects 2 to 9 would have all been referenced to Project 1 or objects would be created dynamically when using JavaScript. The business object project only contained POCO objects, most decorated with DataContract/DataMember attributes.
Can the same logic/Project breakdown be applied when using Web Api? Is it recommended or will I face problem at a later stage?
If it's not recommended, am I suppose to duplicate all my models? Doesn't seem to make sense so I thought I'd ask.
Thanks.
Short answer, YES. The same logic/Project breakdown can be applied when using Web Api. This is also how I implement my architecture. Your Web Api would just be another layer in your architecture. By doing it that way you will allow for greater re-usability of the models (DRY) and maintainability.

How to configure a named resource stream using OData in ASP.NET Web API

I am creating OData endpoints using ASP.NET Web API using v5.8.0 of this NuGet package. I have everything working and I can retrieve simple data such as strings and ints without an issue. However I would now like to extend one of the endpoints so that one of the items that can be retrieved is a binary image file. Having read up on OData I have decided to use named resource streams to achieve this.
The problem I have is that I can find very little information on how to implement this using the ODataController. The closest I can find is this blog post but it is using an older version of Web API and the code does not compile when I use it in my project.
So can somebody please supply a working example of how this should be implemented please.
Named streams (aka stream properties) are not currently supported in Web API OData (for OData v4). See the following issues:
Clarify the situation for streams
Document for Stream Support in OData V4

Getting the schema in swashbuck when using HttpResponseMessage, in WebApi

I'm attempting to use Swashbuckle to generate a swagger inteface for our API, we're returning HttpResponseMessage in our controller methods.
The docs indicate to use the [ResponseType(…)] attribute to indicate the actual return type. But that attribute is restricted to .net 4.5 (I believe, will gladly be proven wrong), and won't work in a .net4 project.
There are the XML comments, however I couldn't see how to use them the generate the schema information (I've taken a look through the unit tests in the project, but couldn't figure out if it's supported)

Queryable Web API 2 OData serialization

I have a lighweight setup where I am using Web API 2 with OData but do not create an "/odata" endpoint with its accompanying "/odata/$metadata" but instead just use standard ApiController's with attribute routing and Get methods marked with an override of [Queryable]: [InlineCountQueryable] detailed here Web API, OData, $inlinecount and testing.
It all works very well except that I can only expose dedicated model classes without any collections or object properties because the JSON serializer serializes the whole object graph. My ideal behavior would be to just have all collections ignored completely and object properties only included on $expand.
I believe this can be made to work because an OData Web Api 2 scaffold VS 2013 creates over an entity framework context has similar behavior, but I would like to keep this as lean as possible and avoid going that route as I found it to be a bit brittle and this service does not need to expose a $metadata description.
Update
I did some digging in the aspnet samples and found the "CustomODataFormatter" sample which seems to expose the machinery I would need to modify.. however the ODataSerializerProvider/ODataSerializer setup outlined there does not work with with attribute routing at all (any method defined with [Route("Some/Url")]).
Given that this seems to be what I need, does anyone know if attribute routing and the odata serializer provider mechanism should work together?
[JsonIgnore] or [DataMember] can be used to ignore properties for json.net serializer. webapi.odata 5.2 supports ODataRouteAttribute, an example is here.

Resources