Java JWT Single Sign On
(SSO) Connector
miniOrange Java JWT Single Sign On (SSO) Connector acts as a JWT Service Provider which can be
configured to establish the trust between the SSO connector and the Identity Provider to securely authenticate
the users into your application. The SSO connector uses the JWT protocol for exchanging authentication and
authorization data with the Identity Provider.
In case you need our help with below integration or sample code for JWT for your language, feel free to reach
out at idpsupport@xecurify.com.
Prerequisites
- Add an Identity Provider. You can add any external IDP or directories (In case you don’t have IdP, you can
use miniOrange as an Identity Provider).
- Customizations support in mobile app to integrate sample code for enabling SSO.
Connect with External Source of Users
miniOrange provides user authentication from various external sources, which can be Directories (like ADFS, Microsoft Active Directory, Azure AD, OpenLDAP, Google, AWS Cognito etc), Identity Providers (like Shibboleth, Ping, Okta, OneLogin, KeyCloak), Databases (like MySQL, Maria DB, PostgreSQL) and many more.
Follow the Step-by-Step
Guide given below for Java JWT SSO Connector
1. Configure Java JWT SSO Connector
- Download miniOrange Java Connector from here.
- Copy the jar file and paste it in WEB-INF/lib folder of your project.
- Copy the following code and paste it in web.xml file of your project.
<servlet>
<description></description>
<display-name>SSOServlet</display-name>
<servlet-name>SSOServlet</servlet-name>
<servlet-class>com.miniorange.app.servlets.SSOServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SSOServlet</servlet-name>
<url-pattern>/sso</url-pattern>
</servlet-mapping>
</servlet-mapping>
Create a System Environment Variable named MO_SSO_CONFIG and give it a
path. Here your properties files used by connector will be stored.
Access SSO connector from your browser with URL
https://<your-domain>/<application-name>/sso.
Register into SSO connector by providing a valid email address and password.
After registration, log in to the dashboard using the credentials you provided during
registration.
2.
Configure Java Connector in miniOrange
In miniOrange dashboard, you can add JWT application with steps below:
- Login into miniOrange Admin Console.
- Go to Apps >> Manage Apps.

- Click on Add Applicaton button.

- In Choose Application Type click on Create App button in JWT application type.

- In the next step, search for your application from the list, if your application is not found. Search for
JWT App and you can set up your Application.

- Copy the Redirect-URL from the JWT Connector.

- Provide the Custom Application name of the JWT application and In the Redirect
url
section add the copied Redirect-URL from the JWT Connector and save the application.
- In the Primary Identity Source section, select the Identity source from where you want
the users to be authenticated.

- Now, click on edit option of the JWT application which we just created.
- Copy client id, client secret and Single Sign on Url of the application.

- Paste the client id, client secret in the client id and client secret fields of the connector
and Single Sign on Url in the Auhtorization Url field of the connector.

- Go to Apps and download the Certificate of the JWT application.

- Open the certificate in a text editor and paste it in the Signing Certificate field of the
Connector.

- In the Application URL field add the url where you want to redirect into your application
after successful authentication and click on save.
- After saving the configuration try Test Configuration.

- On the Application Url which we have previously configured you need to read the user
attributes from the session variable that is sent by SSO connector and use that to
login user into your application.
- You can use the following code snippet in your redirect endpoint to retrieve the
attributes from the session variable.
HttpSession session = request.getSession(false);
Map jwtResponseAttributes = (Map)request.getSession().getAttribute("attributes");
Now that the SSO Connector is configured, you're ready to use it in your application.
Use the following URL as a link in your application from where you want to perform
SSO:
http://<your-domain>/<application-name>/sso?action=login
Additional Resources