owned this note changed 3 years ago
Linked with GitHub

初試 Casbin - 快速搭建符合 99% 產品都需要的高彈性可維護之授權控制系統 - marcus

tags: COSCUP2021 zh-tw COSCUP2021 COSCUP 主議程軌 RB105 - Main Track

歡迎來到 https://hackmd.io/@coscup/2021 共筆

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

點擊本頁上方的 開始用 Markdown 一起寫筆記!
手機版請點選上方 按鈕展開議程列表。

請從這裡開始

權限管理

Authn(你是誰) + Authz(可以做什麼) = 權限管理

Authentication

驗證身分,常見的驗證有:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Authorization

授權可以做的事,不同的授權有不同的權限,常見的權限框架有:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

常見的授權方式

  1. 存取控制清單 Access Control List

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  2. 以角色為基礎的存取控制 Role-Based Access Control

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

  3. 以屬性為基礎的存取控制 Attribute-Based Access Control

    Image Not Showing Possible Reasons
    • The image file may be corrupted
    • The server hosting the image is unavailable
    • The image path is incorrect
    • The image format is not supported
    Learn More →

Casbin

概述


如何做到跨程式語言?

將 Policy 抽象化,以符合使用情境

有趣的舉例



常見的授權設計模式如何實現?

角色有三:員工、主管、HR
每個不同的角色有不同的權限組
Demo 部分見影片
Link of Casbin: casbin.org/zh-CN/editor

如何使用

Enforcer 基本使用

透過配置右方的model.confpolicy.csv,定義左方能做的事

Demo 部分見影片)

修改權限設定時如何即時同步?

透過內建的 Adapter 或 Watcher 進行同步
Casbin 中有提供 Casbin Server

優點討論

如何導入?

連結工程師與主管的想法,才能得到有價值的結果

導入新技術需要說服團隊與老闆,有清楚且完善的規劃與維護

總結

Casbin

呼應題目

Q & A

  • Q1. casbin 的作法是將 auth 整合在 app/api 裡面,請問你認為這跟整合在 api gateway 的作法(i.e. ory oathkeeper)比較起來有什麼優缺點?
    • A1. casbin 只有做授權這件事,不包含驗證,好處為分工比較細,開發、更新、維護較簡單且安全。
Select a repo