SMART on FHIR #asymmetrik/sof-strategy introspectionUrl workflow - node.js

I am looking for sample about Asymmetric SMART on FHIR. Can someone help where/how the introspectionUrl generated using #asymmetrik/sof-strategy?

The introspection url is part of an OAuth2 server that needs to be setup and configured by someone building the FHIR server. We use that module in both our repos (https://github.com/Asymmetrik/node-fhir-server-core, https://github.com/Asymmetrik/graphql-fhir), but it requires an external OAuth2 server. You can read a little more on that here, https://github.com/Asymmetrik/node-fhir-server-core/wiki/Access-Control#available-built-in-options, and here, http://hl7.org/fhir/smart-app-launch/.
If you are not integrating with someone else's SMART enabled OAuth2 server, you can check out projects like https://github.com/mitreid-connect/OpenID-Connect-Java-Spring-Server. We used this server for one of our demo server's in the past and it will give you the endpoint's you need for #asymmetrik/sof-strategy.

Related

Server handles sessions and restful Api in same server?

Im building a chat that uses a api rest full, but i found a problem storage jwt in client side (cookies and his problems), so i opted to use sessions(it's a better option in security terms), that adds state to my app.
I should create a separate server that handles the sessions and also have my rest api?, and apart another server that implements some functionality such as a push server (which I plan to implement). Because I really don't like the idea of ​​having everything on one server, and if so, what should I take into account? (have more than an rest api server and other with his funcionality).
I'm a developer and i think so this require architecture knowledge, and i have no many idea about servers. If you can give me some idea about the topic to get better on it will be great, and what's the better option in this case.
Thanks, give a nice day

Integrate external fingerprint sensor in web app authentication

I am currently working on my final year project, and one of the tasks I am struggling with is integrating biometrics in the authentication system of a web app. I have gone through many readings, questions and blog posts, but none of them seems to deal with the exact same issue.
The problem: I have an external fingerprint sensor (GT21F32 https://www.sparkfun.com/products/14518). Is there any way I could use this sensor in order to get a user to authenticate on my web app?
My thinking process:
have the user input username/password in the login fields;
once they hit login button the server creates a SESSION (call it x) in which they are prompted to put their finger on the sensor;
if everything goes well (data check aganist internal sensor store returns a valid match), user is signed in (mix this with jwt auth?);
similar flow for registering
Regarding SESSION x:
I was considering during that time my authentication API could communicate with an API that wraps the functionality of my sensor
e.g: call a readFingerprint() or searchForFingerprint() function that I implement, which in turn communicates locally with the hardware using it's SDK protocols
I was considering writing this fingerprint API as a node package so that I can use node with Javascript
Please offer me some guidance, since my project supervisor does not really provide much help, and I feel I have exhausted all the possible sources of information.
Thanks a lot!

Securely decouple backend and frontend (node.js server)

I've been looking at node.js, REST APIs and WebSockets lately to further my knowledge about backend and frontend web development. Trying to go with best practices I see REST API comes up all the time. Now my problem which I don't seem to understand how to properly solve.
Say for example I'd like to have client / server decoupled and for this I implement a REST API in the backend so that my frontend will access and get data to render. Specific (imaginary) example: lets say I want to build a rental service website. Now I would like to have an endpoint for my frontend to access information about certain products, let's say the number of bikes that have been rented so far. I'd like to be able to show this on my frontend (through the help of the REST API) but I wouldn't like for other people who call this REST API to be able to get the data (because espionage is a serious business and I'd like to keep the evil ones away, yes they can webcrawl but bla bla). So in essence I'd like for the localhost machine to be able to access (part of) the REST API but not anyone else. Things get complicated because I'd also like people to be able to create a user on my website so then I'd like to have other endpoints which can then be accessed without restriction because I'm thinking, what if at some point I'd like to have a mobile app that is integrated with the service. Then it will be unfeasible to restrict all requests to localhost.
How would you architect a secure server / client as this one? Or in your opinion is it not that big of a deal to have the REST API exposed to others (the evil ones)?
The above goes for WebSockets as well. I know REST APIs are all nice and neat but I think the future lies in near-realtime connections and so I'm likewise as interested in WebSockets (through higher level modules of course, Socket.io, SockJS etc.).
There are many solutions to secure your API out there and many of them are opensource. Which one you'll use really depends your detailed needs.
But to get you started I will mention a solution that is very accepted and supported by a large community:
Have a look at JSON Web Token, which are for example explained in this Article.
Basically your client requests an authentication token from the server and then stores it locally to reuse it for every request to your API.
The Server on the other hand may protect your API as needed. That means you may also have a public API that does not expect a token in the HTTP Header.
Tokens may also expire. That is handy if you, for example, will allow a new user for registering on your site for a limited time.
Here is another article that explains things.
Now on to the websocket part of your question. YES, you definetly want to protect your server side sockets as well. So look out for a library that supports authentication. Again, I think there are a number of opensource libraries out there.
To mention one: Primus.
Primus is an abstraction layer for many socket libraries underneath and lets you quickly change the socket provider. But it also has an authentication hook that you can implement.
And guess what.. you can use it to check for a JSON Web Token!
Hope this gets you started.

How to use Kerberos in a NodeJS server?

I need to migrate a .net kerberos application to a nodejs environment. The application currently takes an incoming request from a .net client and based on the domain and user within domain they are provided with a spgeno token if authenticated to use service. The client then uses this token for all requests to a webservice. I would like to replicate in nodejs however the modules are either poorly documented https://github.com/christkv/kerberos & https://github.com/auth0/kerberos-server or are focused on client side kerberos and not the server side usage. I don't know c++ otherwise I would write bindings to the c/c++ interface so I can call from javascript code. Does anyone have any suggestions on how to undertake migration? Are there any good resources or modules that can be used that will help me?

Securing a RESTful API

For my current side project, which is a modular web management system (which could contain modules for database management, cms, project management, resource management, time tracking, etc…), I want to expose the entire system as a RESTful API as I think that will make the system as more usable. The system itself is going to be coded in ASP.MET MVC3 however if I make all the data/actions available through a RESTful API, that should make the system very easy to use with PHP, Ruby, Python, etc… (they could even make there own interface to manage certain data if they wanted).
However, the one thing that seems hard to do easily (from the user's using the RESTful API point of view) with a RESTful API is security with ajax functionality. If I wanted something that was complex to setup and use, I would just create SOAP services but the whole drive for using a RESTful API is that it is very easy. The most common way of securing a RESTful API with with a key that is associated with a user. This works fine when all the calls are done on the server side however once you start doing ajax functionality, that changes. I would want the RESTful API to be able to be called directly from javascript however anyone who are firebug would easily be able to access the key the user is using allow that person access to the system. Is there a better way the secure a RESTful API where it does not make the user of the RESTful API do complex things just to set it up?
For one thing, you can't prevent the user of your API to not expose his key.
But, if you are writing a client for your API, I would suggest using your server side to do any requests to the API, while your HTML pages provide the data from the user. If you absolutely must use Javascript to make calls to the API and you still have a server side that populates the page in question, then you can obscure the actual key via a one-way digest algorithm in a timestamp-dependant way, while generating the page, and make it that your api checks that digest in a time-dependant way too.
Also, I'd suggest that you take a look into OAuth Nonces and timestamps a bit more deeply. Twitter and other API providers obviously have this problem too, so they must be doing something with the Nonce values.
It is possible to make some signature in request from javascript. But I'm hot sure, how 'RESTfull' urls would be with this extra info. And there you have the same problem: anyone who can see your making-signature-algorithm can make his own signature, witch you server will accept as well.
SSL stands for secure socket layer. It is crucial for security in REST API design. This will secure your API and make it less vulnerable to malicious attacks.
Other security measures you should take into consideration include: making the communication between server and client private and ensuring that anyone consuming the API doesn’t get more than what they request.
SSL certificates are not hard to load to a server and are available for free mostly during the first year. They are not expensive to buy in cases where they are not available for free.
The clear difference between the URL of a REST API that runs over SSL and the one which does not is the “s” in HTTP:
https :// mysite.com/posts runs on SSL.
http :// mysite.com/posts does not run on SSL.

Resources