Alright! We have done so many things with Jenkins by using admin credential which it means we can do everything without any restrictions. But what if let's say we want to create open-source project that should be viewable by everyone. We can create user as authentication and manage roles as authorization. Well, this step can be done at begin actually but it's OK to discuss about it now.
By default or I can say from the begin, the first user we created right after Jenkins installation has admin credential. What we have to do now is create new user with restricted access and guest user for anonymous user.
1. Create New User
Go to Manage Jenkins => Manage Users.
Now, I'll login using the new user.
2. Enable Anonymous User
Go to Manage Jenkins => Configure Global Security.
On the Authorization section, checklist the Allow anonymous read access.
Then, I try to logout and here what anonymous user can see. On the left hand side, there are list of menus. You can see the different with when we login as user. Anonymous users should be only able to view, not execute right?
3. Role-Based Authorization
In the section above, we only have two options to manage users. New user created always be admin and another one when we're not logged in is anonymous. But what if we want to customize the permission to access for each user. Maybe a user only needs to build job, global access is not needed. So, we can use plugin available on Jenkins and we need to install it first.
After that, back to Global Security menu. Now we can see Role-Based Strategy option on the Authorization section.
We also see new menu appear with the name Manage and Assign Roles.
Here we will add some roles with its own permission for each. You can customize based on what you want.
Then, let's assign role to each user. You can add if it's not displayed by typing the user's name manually.
It's a wrap! We already reached to the end of this series. But it's possible for me to add more parts to this series when I learn something new about Jenkins or maybe I'll create new series. So, stay tuned for more updates!
By the way, what I learned about Jenkins so far is from here.
Alright! That's it for now! Any feedback are very welcome and thank you for coming. Follow me to get notified when new post is published by me! Thank you!
Top comments (2)
Wow, @nurulramadhona, this series is so awesome. Definitely gonna be super helpful for others learning about Jenkins! Thank you for writing it :)
I'll be so glad if it's helpful for others.