Steps to Setup On-Premise IDP

Steps to Setup On-Premise IDP

An On-Premise identity provider (IdP) is a service that stores and verifies user identity. IdPs are typically cloud-hosted services, and they often work with single sign-on (SSO) providers to authenticate users.The purpose of this guide is to get you up and run as quickly as possible so that you can play with and test-drive various features that miniOrange has. It is a standalone application with default database and packaged tomcat and does not cover any complex deployment options. We support both windows and linux os for installation.

This short tutorial walks you through starting up the server in standalone mode, setting up the initial admin account, and logging into the miniOrange admin dashboard.


  • Java 8 (JDK 1.8): When you install JAVA 8, only JRE 1.8 would be present.

    Note: Tomcat is already included in this distribution (zip file), you don’t have to install it separately.

    For Windows User - Installation of JDK 1.8 requires login through the oracle account. If you don't have the oracle account, you can directly install JDK 1.8 from here.

    For Linux Users - You can download OpenJDK8 package using apt install openjdk-8-jdk for Debian, Ubuntu, etc. OR yum install java-1.8.0-openjdk for Fedora, Oracle Linux, Red Hat Enterprise Linux, etc.

  • If JAVA is already installed and Environment Varibles are set correcty on your system, then you dont need to follow this step, you can directly go to step 1.2.

    Note - Once the Java installation is complete, check that the JAVA_HOME environment variable has been set correctly.Open a command prompt and type echo %JAVA_HOME% and hit Enter. If you see a path to your Java installation directory, the JAVA_Home environment variable has been set correctly.If nothing is displayed, or only %JAVA_HOME% is returned, you'll need to set the JAVA_HOME environment variable manually.

    For Windows User - Set Java environment variables i.e. JAVA_HOME and JRE_HOME and path variables. Lets say JDK software is installed on your computer, for example, at C:\Program Files\Java\jdk1.8.0_221 then JAVA_HOME and JRE_HOME paths can be as mentioned -

    • JAVA_HOME - C:\Program Files\Java\jdk1.8.0_221
    • JRE_HOME - C:\Program Files\Java\jdk1.8.0_221\jre

    To Save these variables, right click My Computer and select Properties > Advanced System Settings.Click the Environment Variables button.Under System Variables, click New.In the Variable Name field, enter:

    • JAVA_HOME - C:\Program Files\Java\jdk1.8.0_221
    • JRE_HOME - C:\Program Files\Java\jdk1.8.0_221\jre
    Also update the path variable set with path : path_to_JAVA_HOME/bin. You can Read more about java specfic environment variables.

    For Linux Users- Linux users can use below commands to set JAVA_HOME and JRE_HOME variables using below commands -

      export JAVA_HOME=/path/to/jdk export JRE_HOME=/path/to/jre
  • You can verify whether above environment variables are set correctly. Execute below commands to verify environment variables -

      echo $JAVA_HOME echo $JRE_HOME

Install On-Premise Server

  • To start the miniOrange server, go to the bin/ directory of the server distribution (i.e. folder with name similar to mo-idp-server-1.0.3 (version may vary)). Execute the startup file based on your environment.
  • Linux/Unix – Execute chmod +x to give executable permission to this file. Set relevant permission of mo-idp-server folder to allow the creation of new folder like temp or logs folder – chmod 755.
    $ .../bin/
  • Windows
    > ...\bin\startup.bat

1. Setup Database

  • After tomcat startup, open http://localhost:8080 in browser. You will see a page to choose a database configuration for the identity server. You can choose where you would like to store its data.
  • miniOrange On-Premise Identity Provider gives you the flexibility to choose your database type. We support Embedded H2 Database which is a light weight database good for testing purposes. Later you can migrate to your production database type that is supported in the external database section. In External Database section, we support Postgresql (ideally 9.6), MySql and Oracle Databases.
  • miniorange img  Setup Embedded Database
    • Note : Before you proceed with Embedded H2 database, make sure your system has given write permission to the IdP folder i.e. mo-idp-server- folder. If not then first assign the write permission to the IdP folder to avoid getting stuck in permission issues. Write permission is required because Embedded H2 database is created in IdP folder with the folder named data.
    • Select embedded Database and click on proceed.
    • Set up miniOrange with the embedded H2 database to get you started. You’ll need to migrate to a supported external database before using miniOrange as a production system. This option is recommended if you’re just using miniOrange for a test trial. The database folder is created inside the mo-idp-server folder named data.
    • Note: In case if you are stuck in permission issues, you can run commands specific to your OS to perceed or you can follow the instructions given on pop-up.
    • Windows icacls “path upto mo-idp-server-X ” /remove:d Users /grant:r Users:(OI)(CI)F /T
      Linux chmod -R 775 “path upto mo-idp-server-X”
    • If you dont have enough previleges to run above commands, in that case either you can follow instructions from pop-up or can contact us.
    • Once database is created successfully, you will be redirected to the admin set up page where you will configure admin account for Identity Provider.
    • Set up miniOrange with the external database supported in the list below. This is recommended for production systems. miniOrange supports a number of databases and if you don’t have an established database of choice within your organization and do not have a strong preference for any of our supported databases, we recommend the PostgreSQL, which is free and thoroughly tested against.
    • You can refer to the below document to see supported versions of MySQL, MS SQL and PostgreSQL – click here. Note: If you already have a database setup which is not in the list below. You can contact us to add support for that database.
    • Create an empty database in your database server – PostgreSQL/MySQL/MS SQL. Once done, start filling the form shown below –

    • Enter Database Host – localhost or IP address.
    • Enter Database Port :
      PostGres – 5432
      MySQL – 3306
    • Enter the Database Name created in your database server.
    • Enter username and password of your database server for the connection.

    • Once database is created successfully, you will be redirected to the admin set up page where you will configure admin account for Identity Provider.

2. Setup Admin Account

  • Setup your Admin Account. Enter a Username and Password for your admin account.
  • Once your admin account is created, you will be auto logged in to the dashboard screen.

Run On-Premise IdP server over SSL

Before moving forward, you need to make two changes related to samesite cookie. Starting with version 80, Google Chrome will change the default value for the SameSite cookie parameter to Lax. Therefore, changes are required and SameSite parameter has to be set to NONE.

To do changes, follow the path: mo-idp-server >> moas >> WEB-INF >> classes. In this folder search for the file spring-context-onpemise and open it in editor. Search for bean id="customCookie". you will see a bean with name,samesite and secure properties. Update value of samesite from LAX to NONE and of secure to true.

  • This document provides the steps to setup IDP server over SSL . It contains 2 sections A and B.
  • miniorange img  Section A:
    • This section provides the steps to setup IDP over self signed SSL certificate.

      1. Generate a Keystore
      • Open a command prompt or terminal. And go to <Path to JAVA_HOME/bin> path and enter the command given below.
        keytool -genkey -alias onpremssoidp -keyalg RSA -keystore onpremssoidp.jks
      • If you get a permission error (mostly on a windows machine) in this step.Then change the location in command prompt or terminal to Desktop or any other location of your choice. See image in Step 2.
      • Enter your convenient password and remember it.(If the password you entered didn’t work then keep the password as “changeit” ).

      2. Generate SSL Certificate
      • After Pressing the Return key it will prompt for a password for . Hit Return to continue.
        (Note: firstname and lastname needs to be the server DNS name/hostname of the server)
      • SSL self-signed certificate is generated at the given location.

      3. Configure Tomcat with above-generated Keystore
      • Open conf\server.xml (present in tomcat folder).
      • Search for <Service name=”Catalina”> and paste the code snippet given in section 3.a in the next line of<Service name=”Catalina”>.
      • Open conf\server.xml (present in tomcat folder).
      • Search for <Service name=”Catalina”> and paste the code snippet given in section 3.a in the next line of<Service name=”Catalina”>.
        1. Code snippet <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="<JKS Keystore Path>" ciphers="ALL" keystorePass="<Password while keystore generation>"/>
        2. Now you have SSL working on your machine. Follow the steps below if you want to set up the branding. If you don’t want to setup the branding then ignore the steps below and start your tomcat.

      miniorange img  Section B: Using a certificate from Trusted CAs like LetsEncrypt, GoDaddy, Comodo SSL.

      a) LetsEncrypt

      • The following steps assume that you have a valid certificate generated through Certbot. In case you do not have the certificates, you can use the Certbot commands below to generate the certificate for your domain
      • certbot certonly --standalone
      • Once the certificate is generated, the following folder structure will be obtained.
      • #:/etc/letsencrypt/live/ ls
        cert.pem chain.pem fullchain.pem privkey.pem README
      • Copy over the cert.pem, chain.pem, fullchain.pem and privkey.pem in the conf directory of the IdP.
      • Edit the conf/server.xml and add the following connector element.
      •  <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
                                                      maxThreads="150" SSLEnabled="true">
                                                      <Certificate certificateFile="conf/cert.pem"
                                                                      certificateChainFile="conf/chain.pem" />
      • Restart the IdP. The IdP should now use the valid certificate from LetsEncrypt.

      b) Go Daddy

      • The steps below assume that you have downloaded the valid SSL certificates from GoDaddy. The certificates need to be imported in a Java Keystore (JKS). In order to create a JKS, the keytool utility can be used.
      • keytool -genkey -alias onpremssoidp -keyalg RSA -keystore onpremssoidp.jks
      • The original certificates need to be removed from the keystore. That can be done using the below command.
      • keytool -delete -alias onpremssoidp -keystore onpremssoidp.jks
      • OpenSSL commands can be used to import the certificates downloaded from GoDaddy into the Java Keystore.
      • openssl pkcs12 -export -in .crt -inkey .key -out .p12 -name tomcat -CAfile gd_bundle-g2-g1.crt -caname root
      • The keystore can now be used to configure the connector in conf/server.xml.
      • <Connector port="443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true"
                                                  clientAuth="false" sslProtocol="TLS" keystoreFile="<JKS Keystore Path>" ciphers="ALL"
                                                  keystorePass="<Password while keystore generation>"/>
      • Restart the IdP. The IdP should now use the valid certificate from GoDaddy.

      c) Comodo SSL

        Creating a New Keystore

      • Navigate to the directory where you plan to locate the new keystore.
      • Enter the following command:
      • keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore your_site_name.jks
      • When prompted, create a password for your new Keystore.
      • Enter the required information (Note: Do not type your own name into the name field, type your FQDN).
      • When finished, verify your information by typing “Y” or “Yes.” (Minus the period at the end.)
      • Finally, enter the password you just created in step three.

      • Creating a CSR on Tomcat Servers

      • Run the following command:
      • keytool -certreq -alias server -file csr.txt -keystore your_site_name.jks
      • Once prompted, enter the password you created in step three of the Keystore instructions
      • Use the information you supplied when creating the keystore. The CSR will be generated and saved in the chosen directory as “CSR.txt.”
      • We recommend saving and backing up the keystore file once you’ve complete generating the CSR. Once you’ve got the CSR complete, choose the SSL certificate you’d like to install on your Tomcat server and then purchase it, copy/pasting the CSR (open the .txt file) into the relevant field (usually the one labelled CSR).
      • Once the purchase and validation are complete, the CA will email you a bundle that includes your SSL certificate and an intermediate certificate that needs to be installed with it.

      • How to Install an SSL Certificate on Your Tomcat Server

      • Save your certificate(s) to the Keystore directory you created.
      • Use the following command to import the keystore:
      • keytool -import -alias server -file your_site_name.p7b -keystore your_site_name.jks
      • You should see a confirmation message that says: “Certificate reply was installed in keystore.”
      • Type “Y” or “Yes” to trust the certificate.
      • Now, finally, we just need to configure the Tomcat server to serve the website via HTTPS.

      • Configuring Your SSL/TLS Connector

      • Using a text editor, open your Tomcat server.xml file.
      • Locate the connector you want to secure with your new keystore.
      • Configure the connector to use port 443 (HTTPS), your configuration file should look something like this:
      • <Connector port="443" maxHttpHeaderSize="8192" maxThreads="100"
                                                      minSpareThreads="25" maxSpareThreads="75"
                                                      enableLookups="false" disableUploadTimeout="true"
                                                      acceptCount="100" scheme="https" secure="true"
                                                      SSLEnabled="true" clientAuth="false"
                                                      sslProtocol="TLS" keyAlias="server"
                                                      keystorePass="your_keystore_password" />
    • Save the changes to your server.xml file.
    • Restart your Tomcat server.
      • If the above methods dont work follow the link given below
      • Click here to follow the steps if you have any other CA certificates.

      4. Update hostname
      • Update hostnames in server.xml
      • Search for localhost, wherever the localhost is mentioned in server.xml, change it to actual server name. It is there in two places.

      5. Modify the Server Base URL in General Product Settings in the IdP
      • You should now be able to access the deployed On-Premise IdP over HTTPS.
      • From miniOrange admin dashboard, go to Settings>>product settings (present on right top).
      • Enter the Server base URL as shown in the image below.

Run Tomcat as a Service for OnPremise IDP

  • Install Tomcat as Windows Service using a Windows Installer.
  • Navigate to Tomcat Package that was provided by us and copy over the moas folder to the newly installed Tomcat as a service directory root.
  • Navigate to Tomcat As a Service Directory Root\conf and edit the server.xml file.
  • Search for <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true"> in the file.
  • Add this line: <Context displayName="moas" docBase="../moas" path="/" reloadable="false" /> just below the line you searched for
  • Now you can navigate to the windows services panel and start the Tomcat service.
  • Install Tomcat as Linux Service from Apache project site.
  • Unpack the tomcat folder in opt directory. For this, you will need a terminal and root access.
  • Create Tomcat user with restricted permissions:
  • groupadd tomcat
    useradd -s /sbin/nologin -g tomcat -d /opt/mo-idp-server tomcat
    passwd tomcat
  • Set the tomcat user as the owner of the $CATALINA_HOME folder.
  • chown -R tomcat.tomcat /opt/mo-idp-server
  • Configure Tomcat to run as a Service
  • Using init.d
  • Navigate to /etc/init.d , create a directory named as tomcat and paste the below code.
    #!/bin/bash ## Change the path of mo-idp folder below ### BEGIN INIT INFO # Provides: tomcat # Required-Start: $network $remote_fs $syslog # Required-Stop: $network $remote_fs $syslog # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Start Tomcat at boot time # Description: Start Tomcat at boot time ### END INIT INFO export JAVA_HOME=/usr/lib/jvm/jre export CATALINA_HOME=/opt/ export JAVA_OPTS="-Xms250m -Xmx1024m" RETVAL=$? case $1 in start) if [ -f $CATALINA_HOME/bin/ ]; then echo $"Starting Tomcat" su -p -s /bin/sh tomcat $CATALINA_HOME/bin/ fi ;; stop) if [ -f $CATALINA_HOME/bin/ ]; then echo $"Stopping Tomcat" su -p -s /bin/sh tomcat $CATALINA_HOME/bin/ fi ;; *) echo $"Usage: $0 {start|stop}" exit 1 ;; esac exit $RETVAL
  • The script shown above would have a LSB type header to define dependencies and runlevels.
  • To make the script executable:
    chmod ug+x /etc/init.d/tomcat
  • Configure the system to run the script at boot:
    sudo update-rc.d tomcat defaults # Debian, Ubuntu
    sudo chkconfig --add tomcat # Red Hat & co.
  • If you want to remove the service:
    sudo update-rc.d -f tomcat remove # Debian, Ubuntu
  • To start/stop the script manually:
    service tomcat [start | stop]
  • Or the old-fashioned way (Ubuntu):
    /etc/init.d/tomcat [start | stop]
Hello there!

Need Help? We are right here!

Contact miniOrange Support

Thanks for your inquiry.

If you dont hear from us within 24 hours, please feel free to send a follow up email to