# Jenkins Role-based Authorization Strategy

Jenkins, by default, provides a basic level of access control through its built-in security options, but for more granular control, you’ll need to use the Role-based Authorization Strategy plugin. This plugin allows you to define roles with specific permissions and assign these roles to users or groups, offering a more detailed and customizable approach to security.

> Agenda

Step 1 : Install the Role-Based Authorization Strategy Plugin

Step 2 : Create User

Step 3 : Configure Global roles & Item role

Step 4 : Assign Roles to Users or Groups

Step 5 : Ensure the assigned role with the newly created user.

> Jenkins Role Based Strategy creation

**<mark>Step 1 : Install the Role-Based Authorization Strategy Plugin</mark>**

Go to **Manage Jenkins** &gt; **Plugins**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839297517/f5093027-ede9-405c-86c7-712625124af5.png align="center")

In the **Available** tab, search for **Role-Based Authorization Strategy** &gt; Click Install

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839368037/dba5c6ce-b86c-44cc-944f-42b5670fa6d0.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839551293/da8b005b-d4c3-49a5-8fbc-f3ec7944d82e.png align="center")

Go to **Manage Jenkins** &gt; **Security**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839757523/2cbf51f6-bf22-4089-b7b0-cd718fc05307.png align="center")

Under **Authorization** &gt; Select **Role-Based Strategy** &gt; Click **Save**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839879577/198ea750-364b-4d1f-8390-daab487fee3c.png align="center")

Now check Manage Jenkins page &gt; Now the "**Manage and Assign role**" will show

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722839987748/cbcc5675-8c73-4141-b276-53fcf77c8713.png align="center")

**<mark>Step 2 : Create User</mark>**

Go to **Manage Jenkins** &gt; **Users**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722840119308/c7d8ff13-6804-467e-b202-bd0cb03669f1.png align="center")

Click on Create user

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722840188439/a04a71fe-c3bc-42ed-a486-07386e05c8f9.png align="center")

Enter Username, Password, Full Name and mail id &gt; Click **Create user**

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722843756061/92dc3a50-c9b2-456f-9bbf-304c25c61f45.png align="center")

I have created two users

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722843841853/847fb024-8042-474c-9e3a-adb16fddb1c4.png align="center")

**<mark>Step 3 : Configure Global roles &amp; Item role</mark>**

Go to **Manage Jenkins** &gt; **Manage and Assign Roles** &gt; **Manage Roles**.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722840701712/2197956e-dd58-424c-9c3c-acbbf75118ee.png align="center")

**Global Roles: Permissions that apply to the entire Jenkins instance.**

**Global role creation:**

Enter role &gt; Click Add

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722844341146/059e7ee9-c7a5-4bac-9c3c-f134fa3e68a1.png align="center")

I have created an "employee" role in global roles. I have given read access only.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722842138443/8d3576ce-0535-4e4d-b5e3-48a52409a6e2.png align="center")

**Item Roles : Permissions specific to certain projects or jobs**

**Item role creation :**

Role to add - Add role name &gt; Pattern - dev.\* &gt; Click - Add

In pattern \[dev.\*\] - means, Matches any character "dev"

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722841124471/1e4722bd-7fdd-4680-baf9-15999d8065de.png align="center")

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722844521856/b9ecf0e6-d034-47d5-a192-1c9ea017c613.png align="center")

I have created an developer & tester role in item roles. I have given full access to both

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722842334156/e6c4642c-7ba9-407a-8376-95f363796335.png align="center")

**<mark>Step 4 : Assign Roles to Users or Groups</mark>**

Go to **Manage Jenkins** &gt; **Manage and Assign Roles** &gt; **Assign Roles**

I have added two users in Global Roles & given access to employee role

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722844147770/31b62a26-032e-4ce6-99c5-7ebfe71d4d0b.png align="center")

I have given access to the developer role for the "Ragul" user in Item roles. It means "Ragul" users can access only "dev" jobs.

Same like, I have given access to the tester role for the "Ajith" user in Item roles. Ajith users can access only "test" jobs.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722844124388/730ac63e-a1d8-4f27-865b-2e64fcc5d739.png align="center")

**<mark>Step 5 : Ensure the assigned role with the newly created user.</mark>**

Now, login through "ragul" user.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722846314787/658351bf-c4cd-4e81-824d-048cb8688a3f.png align="center")

Ragul users can only run the task called "dev"

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722845541026/90283d30-82ad-4732-8d94-007991cbde44.png align="center")

Now, login through "ajith" user.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722845568548/04c1c2c8-94da-4f48-957d-52899c1088a9.png align="center")

Ajith users can only run the task called "test"

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1722845687709/4da325a4-2b9e-4ca9-8d6b-0d1d1ef62445.png align="center")

No, we have successfully configured "Role-based Authorization Strategy"
