<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SANDESH PATANKAR</title>
    <description>The latest articles on DEV Community by SANDESH PATANKAR (@sandesh_patankar).</description>
    <link>https://dev.to/sandesh_patankar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3162628%2F85ad8d77-4199-488c-926c-0d2aaf3a4463.png</url>
      <title>DEV Community: SANDESH PATANKAR</title>
      <link>https://dev.to/sandesh_patankar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sandesh_patankar"/>
    <language>en</language>
    <item>
      <title>Access Control</title>
      <dc:creator>SANDESH PATANKAR</dc:creator>
      <pubDate>Wed, 14 May 2025 12:59:04 +0000</pubDate>
      <link>https://dev.to/sandesh_patankar/access-control-kma</link>
      <guid>https://dev.to/sandesh_patankar/access-control-kma</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction to Access Control&lt;/strong&gt;&lt;br&gt;
Access control is a corner-stone of modern security frameworks. &lt;br&gt;
It ensures that only authorized users can access specific resources within an organization.&lt;br&gt;
By combining authentication (verifying identity) and authorization (granting permissions), &lt;br&gt;
access control systems safeguard sensitive data and critical operations.&lt;/p&gt;

&lt;p&gt;Authentication methods include usernames, passwords, security tokens, and even multi-factor authentication (MFA). &lt;br&gt;
Authorization, on the other hand, assigns appropriate permissions to authenticated users based on predefined rules.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Concepts of Access Control&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Access control has three main models:&lt;br&gt;
Role-Based Access Control (RBAC)&lt;br&gt;
Access is tied to organizational roles.&lt;br&gt;
Efficient for structured organizations.&lt;br&gt;
Pros: Simplifies permission management.&lt;br&gt;
Cons: Challenging to manage for evolving organizations.&lt;/p&gt;

&lt;p&gt;Attribute-Based Access Control (ABAC)&lt;br&gt;
Access decisions are based on attributes (user, resource, environment).&lt;br&gt;
Pros: Granular and flexible security policies.&lt;br&gt;
Cons: Requires significant effort to implement and maintain.&lt;/p&gt;

&lt;p&gt;Policy-Based Access Control (PBAC)&lt;br&gt;
Access is determined by organizational policies.&lt;br&gt;
Reactive to policy changes and compliance requirements.&lt;br&gt;
Pros: Granular security, compliance-friendly.&lt;br&gt;
Cons: Time-consuming to define and manage policies.&lt;/p&gt;

&lt;p&gt;We chose ABAC for the HRMS Web Application for our Organization.&lt;br&gt;
While developing an HRMS web app for our organization, we opted for Attribute-Based Access Control (ABAC) &lt;br&gt;
because of its flexibility and adaptability. ABAC allowed us to implement dynamic and granular policies &lt;br&gt;
based on user roles, department, resource type, and environmental factors like time and location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technology Stack&lt;/strong&gt;&lt;br&gt;
We are building the HRMS using:&lt;br&gt;
Frontend: React with TypeScript for a robust, type-safe user interface.&lt;br&gt;
Backend: ASP.NET Core 8 for scalable and high-performance API development.&lt;br&gt;
Database: MySQL to handle structured relational data efficiently.&lt;/p&gt;

&lt;p&gt;ABAC Implementation: Step-by-Step Flow&lt;br&gt;
User Login:&lt;br&gt;
Authentication:&lt;br&gt;
User submits credentials (e.g., username and password) via a login form.&lt;br&gt;
Frontend sends an authentication request to the backend API, during authentication process in backend,&lt;br&gt;
Backend validates the user credentials against the database. &lt;/p&gt;

&lt;p&gt;Authorization:&lt;br&gt;
Only authenticated user is sent for an authorization along with it's attributes (e.g. role, department, location).&lt;br&gt;
again it validates the user attributes against the database. &lt;/p&gt;

&lt;p&gt;Secure API Calls:&lt;br&gt;
All API requests include the jwt token to validate the user and enforce attribute-based policies on the backend.&lt;/p&gt;

&lt;p&gt;Policy Enforcement:&lt;br&gt;
Middleware intercepts API requests and extracts the token.&lt;br&gt;
Attributes in the token are matched against resource requirements using predefined ABAC policies.&lt;/p&gt;

&lt;p&gt;Decision Making:&lt;br&gt;
Requests are permitted or denied based on the attribute evaluation.&lt;br&gt;
Example: A request to delete an employee record is allowed only if the user is in the HR department and the action occurs during work hours.&lt;/p&gt;

&lt;p&gt;Upon successful login, the backend returns Logged in user's data along with specific rights, permissions and token (JWT) .&lt;br&gt;
user's data is stored securely in state management (e.g., Redux or Context API).&lt;/p&gt;

&lt;p&gt;Dynamic UI Rendering:&lt;br&gt;
Components, Menus, Buttons and features are conditionally rendered based on user rights and permissions.&lt;br&gt;
Example: Only HR personnel can view sensitive payroll data.&lt;/p&gt;

&lt;p&gt;Database:&lt;br&gt;
Storing Attributes:&lt;br&gt;
User attributes (e.g.id, role, department) are stored in relational tables.&lt;br&gt;
User Permissions (e.g.List of Rights and Permissions) are also stored in relational tables.&lt;br&gt;
Resource attributes (e.g. Paths, file type, Access level) are also managed here.&lt;/p&gt;

&lt;p&gt;Querying for Policies:&lt;br&gt;
Dynamic queries are built to fetch relevant policies based on user and resource attributes.&lt;/p&gt;

&lt;p&gt;Key Benefits of ABAC in HRMS&lt;br&gt;
Granularity: Fine-tuned access control policies ensure that users access only what is necessary.&lt;br&gt;
Flexibility: Policies adapt dynamically to changing requirements, such as promotions or department transfers.&lt;br&gt;
Security: Combines user, resource, and contextual attributes to provide robust security.&lt;br&gt;
Challenges and Lessons Learned&lt;br&gt;
Complexity: Designing ABAC policies for diverse organizational roles required thorough planning.&lt;br&gt;
Performance: Attribute-based evaluation added slight overhead, which was mitigated using efficient indexing and caching.&lt;br&gt;
Maintenance: Regular updates to policies and attributes are essential to reflect organizational changes.&lt;/p&gt;

&lt;p&gt;Conclusion&lt;br&gt;
ABAC proved to be an invaluable access control strategy for our HRMS project. Its adaptability, &lt;br&gt;
combined with the powerful React-ASP.NET-MySQL stack, ensured a secure, user-friendly, and scalable solution. &lt;br&gt;
While implementation demands initial effort, the long-term benefits of granular and context-aware access control outweigh the challenges.&lt;/p&gt;

&lt;p&gt;Would love to hear your thoughts and experiences with access control! Share them in the comments below.&lt;/p&gt;

</description>
      <category>programming</category>
      <category>security</category>
    </item>
  </channel>
</rss>
