HI all, this document deals with how to setup OAuth for Jenkins using keycloak.
Jenkins is one of best DevOps tool which is used for CICD And keycloak is another best opensource tool which can be used for SSO authentication.
It will be very difficult for users to have a different username and password for various applications. let’s say if u use 10 different applications, this will lead you to 10 different usernames and passwords. In order to overcome this kind of situation it will be always better to use a common platform for authentication for all these applications, Here comes keycloak in the picture.
Here we will show you how to do this for Jenkins’s application using keycloak. Stay Tuned for other DevOps tools.
Step 1: Log in to keycloak
Step 2: Create a realm for common authentication for your applications
Step 3: Create a client for Jenkins as given below.
Step 4: Select installation from the newly created client “Jenkins” and select keycloak OIDC JSON from the format option in the installation tab. copy and save it for future use.
Step 5: log in to Jenkins and go to manage the plugin and install the keycloak authentication plugin.
Step 6: Goto Configure Global security from manage Jenkins and enable keycloak authentication plugin for access control with authorization, a logged-in user can do anything. In the future you can do role-based access.
Step 7: Goto configure the system from manage Jenkins and paste the previous copied statements from the keycloak client installation tab.
Step 8: Create a user in keycloak for common authentication.
Step 9: save all the settings in Jenkins and keycloak. And logout from the Jenkins app.
Step 10: Browse Jenkins’s application for login. This will take you to the login screen of keycloak for SSO authentication. Once you logged in keycloak it gets redirected back to the home screen of Jenkins after successful login.
Hope you guys liked it. Please share your thoughts on the comment section.
© 2020, Techrunnr. All rights reserved.