Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Date:

Author:

Version:

Changes:

Completed

Ext.

Int.

Is in Core

Jira Ref.

0.1

Doc. created

Yes/No

x

 

N/A

 

14/04-2016Anders Granau Høfft0.2Sections expandedNox N/ACDRRM-733
11 May 2016Emil Ifrim0.3Database configurationNox N/A 
20 March 2017Emil Ifrim0.4Redesign UpdateNox N/A 
01 April 2018Emil Ifrim0.5Redesign UpdateNox N/A 

...

This is a brief guide on how to install the REST service (rator-selfcare-rest-api project and rator-rest-api-auth project). A customer rest project involves deploying three artifacts:

...

This section is about how to modify the customer project's pom so as to include the selfcarerator-rest-api in the build.

Note

...

Info

This section describes installation of the core services. For a customer setup, an additional war has to be deployed (the one containing the customized REST services)

  1. Retrieve the rator-selfcare-rest-api .war file (either from Jenkins/Nexus, see Resources, or by building the .war yourself, see Build).
  2. Retrieve the rator-rest-api-auth.war file (either from Jenkins/Nexus, see Resources, or by building the .war yourself, see Build).
  3. Copy the war files to the Tomcat webapps directory and (re-)start the Tomcat application.
  4. Retrieve the swagger-ui dist folder (either from Github, or from our own repositories, see Resources. Or by building the project yourself, see Build).
  5. Copy the dist folder to the Tomcat webapps directory and (re-)start the Tomcat application. You probably want to rename the dist folder to swagger-ui
    1. Nb This can be a different Tomcat installation than in step 2, or the same.
  6. In your browser, enter the URL "http://<Swagger server and port>/<base-path>/?url=http://<REST server and port>/<base-path>/api/swagger.json". 
  7. You should now see a list of the resources available on the REST server.
  8. In order to access secure resources through swagger-ui, two one additional parameters parameter must be configured in the Properties.txt file:
     

    Code Block
    languagesql
    titleoauth2 selfcare client
    rest.api.accessTokenUri=http://<host>:<port/<auth-app-context>/oauth/token #example: http://10.45.1.81:8081/rator-rest-api-auth/oauth/token
    rest.api.userAuthorizationUri=http://<host>:<port/<auth-app-context>/oauth/authorize #example: http://10.45.1.81:8081/rator-rest-api-auth/oauth/authorize


 

Compatibility matrix
rator-selfcare-rest-apSwagger UI
1.02.1.1

...

  1. Run table_changes.sql
  2. Configure REST api clients - who is allowed to get security tokens in order to access resources that require authentication/authorization. Here are some examples:

    Code Block
    languagesql
    titleoauth2 selfcare client
    Insert into OAUTH_CLIENT_DETAILS
       (CLIENT_ID, CLIENT_SECRET, SCOPE, AUTHORIZED_GRANT_TYPES, ACCESS_TOKEN_VALIDITY, REFRESH_TOKEN_VALIDITY, AUTHORITIES)
     Values
       ('rator-selfcare-web-app', 'ratorselfcare', 'read,write', 'password', 600, 0);, 'ACCESS_BRAND_brandKey'); --replace brandKey with a valid brand in the setup

    Note: Swagger-ui client should only be used in development environments!

    Code Block
    titleoauth2 swagger-ui client
    Insert into OAUTH_CLIENT_DETAILS
       (CLIENT_ID, CLIENT_SECRET, SCOPE, AUTHORIZED_GRANT_TYPES, ACCESS_TOKEN_VALIDITY, AUTOAPPROVE, AUTHORITIES)
     Values
       ('your-client-id', 'your-client-secret', 'read-write:api-doc', 'implicitpassword,operator_password,client_credentials', 
        600, 'true', 'ACCESS_BRAND_brandKey'); --replace brandKey with a valid brand in the setup

 

Verify deployment

In your browser, enter the URL:

...

Code Block
http://localhost:8080/swagger-ui/?url=http://localhost:8080/rator-selfcare-rest-api-bootstrap/api/swagger.json

If you get an error response from the server, try pin pointing the problem:

...

Code Block
<Context antiJARLocking="true" docBase="C:\Program Files\Tomcat\apache-tomcat-7.0.54\webapps\rator-selfcare-rest-api-bootstrap" path="" reloadable="true" source="org.eclipse.jst.jee.server:rator-selfcare-rest-api"/>

If the Tomcat's server.xml file had a <Context/> tag like the above, where the base path for the rator-selfcare-rest-api-botstrap is set to the empty string, the project would be available at http://localhost:8080/api/<SOME RESOURCE>.

...

The artifacts to deploy (the REST application and Swagger UI) can either be produced manually from source code (see below - Installation guide), downloaded from Nexus, or retrieved from Jenkins.

SVN

...

Jobs are set up to do continuous integration. The artifacts produced from a build are placed in the given job's "Workspace" (Arbejdsområde) page, in the folder "target":

Nexus

Our Jenkins jobs are configured to deploy to Nexus. On Nexus, you can find both the source code and the artifacts produced from the build.

...

For information about how to include the selfcarerator-rest-api project in the customer project's build, see the section 'How to include the REST api in customer projects'.

...

You can build the artifacts yourself. Notice that the Swagger UI is not a Java project, for which reason its build procedure is different than the REST application.

rator

...

-rest-api

  1. Check out the source code (See the Resources paragraph above)
  2. Create the artifact: mvn clean package
  3. You should now have a rator-selfcare-rest-api-bootstrap-<version>.war file in the target folder.

...