Interested is participating in the Google Summer of Code program? Please see the GSOC wiki page.

Wiki Spaces

Documentation
Projects
Resources

Get Help from Others

Q&A: Ask OpenMRS »
Discussion: OpenMRS Talk »
Real-Time: IRC Chat

Projects

Skip to end of metadata
Go to start of metadata

Module developers can chose to protect their module resources by OAuth2 Protocol using the OAuth2 module. 

The OAuth2 module hosts a Spring Security Filter Chain which can be configured to intercept URI's specific to your module. Currently we are supporting only static configuration i.e you will be required to change the OAuth2 module source, package and deploy it before it can intercept requests to your module. In future, we will provide hooks to the OAuth2 module to allow for seamless dynamic integration with your module.

Note : By default, OAuth2 module intercepts requests to the FHIR module.

Configure OAuth2 module to protect resources of any module

For this, you will need to fork/clone the OAuth2 module from it's GitHub repository : https://github.com/maany/openmrs-module-oauth2-prototype

  1. Once you have the source code, add the following web/http security (Spring Security) configuration snippet to /omod/src/main/resources/webModuleApplicationContext.xml
OAuth2 module : add new protected resource

Make sure you replace <resource_uri> with the URI of the resource you want to protect using OAuth2.

       2. Goto root directory of module and run the Maven command "mvn package" to package the OAuth2 module

       3. Install the OAuth2 module on the OpenMRS installation. 

       4. Install your module on the OpenMRS installation.

Now if you try to access the URI specified, you would only be able to access it if the request is accompanied by a valid token issued by the OAuth2 module.

 

 

 

 

 

 

  • No labels