Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Access Control Management With Swift

Access Control Management With Swift

Leverage the power of Swift to make your app better by controlling which resources can users access and what actions can they perform

Avatar for Mostafa Abdellateef

Mostafa Abdellateef

October 21, 2018
Tweet

Other Decks in Programming

Transcript

  1. ACCESS CONTROL MANAGEMENT 101 AUTHENTICATION VS AUTHORIZATION Authentication and Authorization

    address two different questions, Authentication means who are you? and Authorization means what are you allowed to do?
  2. IMAGINARY NEWS APP THE REQUIREMENTS ▸ Anyone can browse public

    groups even if he is an anonymous user ▸ Browsing private groups and posting to them is restricted to group members ▸ Deleting posts in a group is restricted to group admins only (note that group admin can browse and post to his group as well) ▸ Super admin can browse, post, or delete posts from any group
  3. GREAT !! WE NEED TO ADD MORE RULES TO THE

    SYSTEM —World’s Best Boss
  4. ACCESS CONTROL MANAGEMENT 101 ACL (ACCESS CONTROL LIST) list of

    permissions attached to an object, usually represented as a table of privileges
  5. ACCESS CONTROL MANAGEMENT 101 IBAC (IDENTITY BASED ACCESS CONTROL) ‣

    Each individual is given specific access rights for every operation ‣ IBAC can be used in simple systems with few users, However as systems grow in user numbers, it usually gets difficult to manage
  6. ACCESS CONTROL MANAGEMENT 101 RBAC (ROLE BASED ACCESS CONTROL) ‣

    Privileges are grouped into roles and each user is assigned a role (Think of a role as a group of users that have some common characteristics). ‣ The difference between IBAC and RBAC it that the role, instead of the individual, is the basis for access checks.
  7. ACCESS CONTROL MANAGEMENT 101 HRBAC (HIERARCHICAL ROLE BASED ACCESS CONTROL)

    ‣ RBAC implemented as a hierarchy of roles, allowing roles to inherit privileges from other roles ‣ (GroupAdmin inherits browsing group permission from GroupMember because every group admin is-a group member ).
  8. ACCESS CONTROL MANAGEMENT 101 ABAC (ATTRIBUTE BASED ACCESS CONTROL) ‣

    Grant access to members belong to a role who also have specific characteristics ‣ Defining access rights based on the various properties of a user
  9. THE EXECUTION LET’S START BY WHAT WE WANT TO ACHIEVE

    // The Group member policy GroupMember.shouldBeAbleTo(BrowseGroup) .when(member.groupId == action.groupId) // create users ahmed = GroupMember(name = "Ahmed", age = 18, groupId = 1) mostafa = GroupMember(name = "Mostafa", age = 18, groupId = 2) // create action browseGroup2 = BrowseGroup(groupId = 2) // check if user is allowed ahmed.can(browseGroup2) // false mostafa.can(browseGroup2) // true