liveBook · Manning

Role

As explained in Software Security for Developers

A role is a named collection of permissions or access responsibilities assigned to a subject in an access-control system.

A role is a named bundle of permissions representing responsibilities or access rights. Assigning a role avoids granting individual permissions separately to every user or service. section 17.1.1

Role-based access control (RBAC) asks whether a subject has a role that permits the requested action. If the role allows it, access is granted; otherwise, access is denied. section 17.1.1

A role commonly groups permissions by responsibility:

A role check at an endpoint

A token can carry a roles claim such as roles: ["manager"]. An endpoint can then require a particular role, as with Spring Security’s @PreAuthorize("hasRole('ADMIN')") on an administrative dashboard. section 17.1.1

Figure 17.2 Roles and their associated permissions in RBAC. Each role represents a bundle of permissions. A user assigned to a role automatically inherits all the permissions granted by that role. This structure simplifies access control but can become difficult to manage as permission needs grow more specific.
figure

Visualize each role as a security badge that automatically inherits its associated permissions, while recognizing that increasingly specific needs make roles harder to manage. section 17.1.1

Roles are easy to understand and widely supported, but large systems can develop role explosion: narrowly tailored roles become difficult to name, manage, and audit. When access depends on attributes such as department, region, or request time, ABAC may fit better; when it depends on relationships, ReBAC may fit better. section 17.3

Distributed systems also require consistent enforcement. Every service should account for where authorization checks live, how identity information is shared, and how access is logged rather than blindly trusting another service. section 17.2

How Software Security for Developers covers it

How deep it goes
Explains definitions, role inheritance, endpoint checks, role explosion, and distributed enforcement, but not implementation internals.
Examples
Uses employee, manager, and admin responsibilities, a JWT roles claim, and a Spring Security endpoint check.
What it assumes
Assumes only basic familiarity with users, services, resources, and requested actions; defines permissions and roles directly.
What you can do after
Evaluate access designs by assigning responsibility-based roles and recognizing when attributes or relationships require another model.
How it connects
Connects roles with permissions, RBAC, ABAC, ReBAC, JWT claims, authorization, and microservices.

Also explained in

Compare how 11 books explain role →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.