Skip to content

Instantly share code, notes, and snippets.

View balteravishay's full-sized avatar

Avishay Balter balteravishay

  • Microsoft
  • Israel
View GitHub Profile
version: '2'
volumes:
app-drive:
name: ${APP_VOLUME_NAME}
services:
app:
container_name: ${APP_CONTAINER_NAME}
build: .
@balteravishay
balteravishay / anaconda-test-pipeline.yaml
Last active December 21, 2022 09:15
conda uniqueness pipelines
trigger:
- main
variables:
- name: CONDA_ENV_NAME
value: test-env-$(Build.BuildNumber)
jobs:
- job: Test
@balteravishay
balteravishay / ReaderAccess.cs
Created November 7, 2021 10:40
Reader Access
namespace PMVProxy.API.Middleware
{
using Hl7.Fhir.Model;
...
internal class OwnerAccess : IAccessByRole
{
...
public async System.Threading.Tasks.Task Access<TResource>(TResource resource,
@balteravishay
balteravishay / OwnerAccess.cs
Last active November 7, 2021 11:37
Owner Access
namespace PMVProxy.API.Middleware
{
using Hl7.Fhir.Model;
...
internal class OwnerAccess : IAccessByRole
{
...
public async System.Threading.Tasks.Task Access<TResource>(TResource resource,
@balteravishay
balteravishay / AuthorizedFhirService.cs
Last active November 7, 2021 11:35
Authorized Fhir Service
public async Task<TResource> CreateAsync<TResource>(User user, TResource resource)
where TResource : Resource, new()
{
var userFhirId = await GetUserFhirId(user);
return await _accessMiddleware.AuthorizeAsync(
resource,
user.Role,
userFhirId,
this,
async (doc) =>
@balteravishay
balteravishay / PatientController.cs
Created October 25, 2021 06:48
Create a FHIR patient
[HttpPost]
[Authorize(Policy = "OwnerOrAdmin")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Patient))]
[ProducesResponseType(StatusCodes.Status500InternalServerError, Type = typeof(Error))]
[ProducesResponseType(StatusCodes.Status422UnprocessableEntity, Type = typeof(UnprocessableInputException))]
public async Task<IActionResult> CreatePatient([FromBody] dynamic value)
{
Patient patient = _fhirParser.Parse<Patient>(value.ToString());
var user = ((User)HttpContext.Items["User"]);
patient = await _authorizedFhirService.CreateAsync(user, patient);
@balteravishay
balteravishay / IAuthorizedFhirService.cs
Last active November 7, 2021 11:36
Authorized Fhir Service
namespace FhirProxy.API.Core.Services
{
using Hl7.Fhir.Model;
using FhirProxy.API.Model;
using System.Threading.Tasks;
public interface IAuthorizedFhirService: IFhirService
{
Task<TResource> CreateAsync<TResource>(User user, TResource resource)
where TResource : Resource, new();
@balteravishay
balteravishay / BaseFhirClient.cs
Last active November 7, 2021 11:36
firely base fhir client
using Hl7.Fhir.Model;
...
namespace Hl7.Fhir.Rest
{
public abstract partial class BaseFhirClient : IDisposable
{
...
public Task<Resource> GetAsync(string url)
@balteravishay
balteravishay / relayingParty.xml
Last active October 25, 2021 08:59
relying party
<RelyingParty>
<DefaultUserJourney ReferenceId="SignUpWithHintOrSignIn" />
<UserJourneyBehaviors>
<JourneyInsights TelemetryEngine="ApplicationInsights" InstrumentationKey="[YOUR INSTRUMENTATION KEY]" DeveloperMode="true" ClientEnabled="false" ServerEnabled="true" TelemetryVersion="1.0.0" />
</UserJourneyBehaviors>
<TechnicalProfile Id="PolicyProfile">
<DisplayName>PolicyProfile</DisplayName>
<Protocol Name="OpenIdConnect" />
<OutputClaims>
<OutputClaim ClaimTypeReferenceId="displayName" />
@balteravishay
balteravishay / orchestrationstep5.xml
Created October 21, 2021 10:28
orchestration step 5
<OrchestrationStep Order="5" Type="SendClaims" CpimIssuerTechnicalProfileReferenceId="JwtIssuer">
</OrchestrationStep>