SSO With Freshdesk and Spring Boot Application using JWT

What is SSO?

Single sign-on (SSO) is an authentication scheme that allows a user to login with a single ID to any of several related, yet independent, software systems. True single sign-on allows the user to log in once and access services without re-entering authentication factors.

What is Freshdesk?

Online cloud-based customer service software providing helpdesk support with all smart automations to get things done faster.

What is Spring Boot?

Spring Boot is an open source Java-based framework used to create a micro Service. It is developed by Pivotal Team and is used to build stand-alone and production ready spring applications.

What is JWT?

JSON Web Token is a proposed Internet standard for creating data with optional signature and/or optional encryption whose payload holds JSON that asserts some number of claims. The tokens are signed either using a private secret or a public/private key.

Create Spring Boot Application

1) LoginAppSsoApplication.java

 

2) LoginController.java

 

3) LoginDTO.java

 

4) index.html

 

5) success.html

 

6) logout.html

7) error.html

 

8) application.properties

9) Run the Spring Boot Application

Configure Spring Boot Application with Freshdesk

1) Login into Freshdesk Application

2) Go to Admin Part

3) Go to Security Setttings and Activate Freshworks SSO

4) Configure SSO

5) Select JWT Method

6) Paste Login form url of Spring Boot Application in Authorization URL Paste RSA public key in RSA Public Key and Paste logout url of Spring Boot Application in Logout URL.

7) Click on configure SSO

8) Create JWT token

Signature:-

Generate
Public Key and Private Key:-

->
https://www.novixys.com/blog/how-to-generate-rsa-keys-java/

->
https://www.aurigait.com/blog/xml-signatures-build-a-secure-channel-for-data-exchange-and-communication/

->
https://www.baeldung.com/java-read-pem-file-keys

Use
Private key in Spring boot application for create or
signing
token

Use
Public key in FreshDesk Application in Configuration part

9)Read nonce and state part from url in Spring Boot Application

From
this url :-
https://sso-auriga-app.herokuapp.com/?response_type=id_token&client_id=464307824220156643&scope=openid%20email%20profile&state=YXVyaWdhaXQtNDY0MzA3MjU0NDczMDMyNjMzLm15ZnJlc2h3b3Jrcy5jb207RTJRaEFldGFRbU9icVMxa25vUHU4OXVZK1l3NTk5K0xQZUl2dGdKbm9Wdz07N2NXTXhxY05QUjRBSjEzag%3D%3D&redirect_uri=https://aurigait-464307254473032633.myfreshworks.com/sp/OIDC/464307824220156643/implicit&registration_id=464307824220156643&nonce=7cWMxqcNPR4AJ13j

10)Implement all this fields in given below code

 

11) Hit the given url

https://aurigait-464307254473032633.myfreshworks.com/

12) Click on SSO Login

13) You will redirect to Spring Boot Application login page

14) Input your login credentials of Spring Boot Application

15) On Successful login you will redirect to dashboard page of freshdesk ( Login Success in FreshDesk )

16) On Successful logout from freshdesk, you will redirect to logout of Spring Boot Application page

Thank You

Comments