Cloud Repositories for JasperReports IO At-Scale

This chapter describes how JasperReports IO At-Scale can use reports and resources stored in the cloud repositories (Google Drive, Github, and Dropbox) using OAuth 2.0 standard protocol for authorization.

OAuth2 Repositories

By default, JasperReports IO At-Scale comes with three preconfigured OAuth2 repositories for Google Drive, Github, and Dropbox. Each of these is defined in the following folders:

jrio-export-docker/jrio/applicationContext-google-drive.xml

jrio-export-docker/jrio/applicationContext-github.xml

[jrio-export-docker/jrio/applicationContext-dropbox.xml

jrio-reporting-docker/jrio/applicationContext-google-drive.xml

jrio-reporting-docker/jrio/applicationContext-github.xml

jrio-reporting-docker/jrio/applicationContext-dropbox.xml

jrio-rest-docker/jrio/WEB-INF/applicationContext-google-drive.xml

jrio-rest-docker/jrio/WEB-INF/applicationContext-github.xml

jrio-rest-docker/jrio/WEB-INF/applicationContext-dropbox.xml

To use these repositories, each repository configuration file needs to be updated with actual clientId and secretKey values. These values are obtained from the target cloud storage providers while registering your JasperReports IO At-Scale instance with them.

The configuration file for Google Drive repository will appear similar to the following:

<bean class="com.jaspersoft.jrio.common.repository.google.GoogleDriveRepositoryService">
   <property name="jasperReportsContext" ref="baseJasperReportsContext"/>  
   <property name="googleDriveProvider">
      <bean class="com.jaspersoft.jrio.common.repository.google.RequestTokenGoogleDriveProvider">
         <property name="googleDriveFactory">
            <bean class="com.jaspersoft.jrio.common.repository.google.GoogleDriveFactory">
               <property name="clientId" value="put-client-id-here"/>
               <property name="secretKey" value="put-secret-key-here"/>
             </bean>
         </property>
         <property name="serviceCache">
            <bean class="com.jaspersoft.jrio.common.execution.cache.LocalCacheAccessFactory">
               <property name="cacheContainer" ref="localCacheManager"/>
               <property name="cacheRegion" value="googleDriveServices"/>
            </bean>
         </property>
       </bean>
    </property>
</bean>

Accessing Cloud Repositories

The sample web application helps you connect to the cloud repositories (Google Drive, Github, and Dropbox) by providing a login UI. You can access the sample cloud repository login UI if you have the required OAuth2 credentials, namely clientId and secretKey. These values need to specify in both repository configuration files and client application configuration file [JRIO_DOCS_WEB_APP]/WEB-INF/classes/jasperreports.properties.

The sample web application acts as a proxy to the JasperReports IO At-Scale application and acquires the OAuth2 authorization tokens from the cloud services. Then these access tokens are passed to the JasperReports IO At-Scale, allowing JasperReports IO At-Scale to load reporting resources from the remote repositories.