6

一个简单的UserCase,带你认识openLooKeng的行级权限控制

 2 years ago
source link: https://my.oschina.net/u/4742090/blog/5306845
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Hi,朋友。openLooKeng近期带来了许多技术干货,前有安装部署,后有安全认证机制、Hash Join的使用介绍等等,如果您正在使用openLooKeng, 希望这些技术博客能够帮助到您。本期,社区小伙伴将用一个User Case,简单介绍openLooKeng的行级权限控制

openLooKeng的行级权限控制

行级权限的作用

通过 Rowfilter 实现对表数据行级别的权限控制:指定特定用户只能访问授权过的行,隐藏未授权的行数据。

Use Case

源数据表:

配置Rowfilter策略:

查询效果:

Rowfilter实现方式

回顾一下openLooKeng的coordinator接收到一个SQL的处理过程:终端用户通过ODBC或者JDBC driver将一个SQL语句发送到coordinator,这时SQL是以文本的形式被接收的。coordinator会解析parse和分析analysis,然后生成query plan。

openLooKeng analysis过程分为两部分:StatementRewrite和StatementAnalyzer。这两部分中都有权限相关的检查。

  1. Rangeradmin侧仅存储鉴权策略,而鉴权逻辑在openLooKeng侧的ranger-plugin中完成。
  2. Rowfilter策略实际就是where条件子句。

所以,在StatementRewrite中将Rowfilter条件子句重写到sql中。

主要的代码修改涉及:

  1. Ranger侧:修改openLooKeng数据源的策略定义,增加行权限策略的配置界面。

  2. openLooKeng侧:增加一个新的rewrite类:RowFilteRewrite,将条件子句加到sql中。


以上便是本期小伙伴带来的分享。如果您也想在社区分享您的文章,欢迎联系openLooKeng小助手。

您可以star和fork代码仓,随时获取仓库动态。

欢迎访问openLooKeng官网 https://openlookeng.io

社区代码仓 https://gitee.com/openlookeng

原创不易,转载请联系小助手


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK