Demo Application showing how to use Labshare User Managed Resource Sharing (UMRS)

NgAuth Setup

Create UmrsDemo Api

Name: Umrs Demo
Identifier: http://labshare/umrs-demo

Create App

Name:umrs-client
Client Id: umrs-client
Application Type: Web App
Callback URL: https://local.mylocal.org:4203/auth-callback
Post Logout Redirect Url: https://local.mylocal.org:4203/auth-logout
Response Types: code
Grant Types: authorization_code

Create Backend App for client credential flow

Name:umrs-backend
Client Id:umrs-backend
Application Type:Web App
Client Secret: some secret guid
response Types: None
Grant Types: Client Credentials
Token Endpoint Method: client Secret post
UNSELECT ALL PROVIDERS

Create Client Roles and permissions for use with credentials flow

Create a client role umrs-back-end-roled for the umrs-back-end client
Create/Add permission auth.umrsGrants.list to the role ## Create (Access Request) User Roles 
Name: Umrs_View_Patient_Data
Resource Server: UMRS Demo

Name: Umrs_Upload_Patient_Data
Resource Server: UMRS Demo

Grant Access via Access Grants Screen

Give yourself access to Umrs_View_Patient_Data
Give yourself access to Umrs_Upload_Patient_Data

umrs-server Setup

Create .env file under umrs-server folder

For Example

DB_CONNECTION = [your database connection string]
ISSUER=http://localhost:7000/_api/auth/ls
SERVICES_AUTH_URL=http://localhost:7000/_api
AUDIENCE=http://labshare/umrs-demo
SERVICES_AUTH_CLIENT_ID=umrs-backend
SERVICES_AUTH_CLIENT_CREDENTIAL=<client secret guid of umrs backend app>
SERVICES_AUTH_TENANT=ls

# callback url https://local.mylocal.org:4203/auth-callback
# post logout redirect url https://local.mylocal.org:4203/auth-logout
ACCESS_CONTROL_ALLOW_ORIGIN="*"
SERVER_PORT=3000

UMRS_CLIENT_ID=umrs-client
UMRS_VIEW_PATIENT_DATA=Umrs_View_Patient_Data
UMRS_UPLOAD_PATIENT_DATA=Umrs_Upload_Patient_Data
UMRS_VIEW_STUDY_DATA=Umrs_View_Study_Data
UMRS_MANAGE_STUDY_DATA=Umrs_Manage_Study_Data

VIEW_PATIENT_REQUEST_TEMPLATE=View_Patient_Request_Template

READ_STUDY_REQUESTABLE_ACCESS_ID=1
READ_STUDY_REQUESTABLE_ACCESS_NAME=View_Study_Request_Template
READ_PATIENT_REQUESTABLE_ACCESS_ID=2
READ_PATIENT_REQUESTABLE_ACCESS_NAME=View_Patient_Request_Template

Start Auth (if authenticating locally)

Setup alias in hosts file to enable running ssl locally

add this line to /etc/hosts file:
127.0.0.1 auth.local local.mylocal.org

Start umrs-server

cd to umrs-server directory
npm install
npm run build
npm run startssl

Start umrs-client

cd to umrs-client directory
npm install
npm run start

Docker

docker build -t umrs-client:current --build-arg CONFIGURATION=ci --build-arg NPM_TOKEN=xxx .
docker build -t umrs-server:current --build-arg NPM_TOKEN=xxx .