Skip to content

Optimize the default authentication plugin. #13164

Open
@KiteSoar

Description

@KiteSoar

Is your feature request related to a problem? Please describe.
Now, the authentication plug-in provided by Nacos by default needs to persist some information. The data source is supported by MySQL and Derby by default.
现在Nacos默认提供的鉴权插件需要持久化一些信息,数据源默认支持MySQL和Derby

Image

At present, the data source is also provided in the form of a plugin.
目前数据源也是提供插件的形式

Image

If users do not use Derby and MySQL as data sources, they not only need to implement the logic of the corresponding data source according to the Mapper interface provided by the Datasource package, but may also need to rewrite the persistence method in the authentication plugin according to this data source. This feels very strange. When changing the data source, why do you need to modify the things in the authentication plugin in addition to customizing the data source plugin? In addition, currently some SQL statements of the authentication plugin are directly hardcoded, as shown in the following figure.
如果用户不用Derby和MySQL当数据源的话,用户不仅需要自定义数据源插件,可能还要把鉴权插件里持久化的方法也按照这个数据源重写,这个感觉就很奇怪,换个数据源,除了自定义数据源插件,为什么还要去改鉴权插件的东西,除此之外,目前鉴权插件的一些SQL都是直接写死的,如下图所示

Image

这样一旦不同数据源间有语法冲突,如#ISSUE12964,就只能去改Service层的代码,没有抽象出类似Mapper的接口来供多数据源重写

Describe the solution you'd like

  • The authentication plugin depends on the data source plugin. Put the persistence logic of the authentication plugin into the data source plugin and abstract the corresponding Mapper interface at the same time.
  • If the authentication plugin does not depend on the data source plugin, do not hardcode SQL in the Service of the authentication plugin. Instead, abstract a Mapper interface.
  • 鉴权插件依赖数据源插件,把鉴权插件持久化的逻辑放到数据源插件里去,同时抽象出对应的Mapper接口
  • 或者如果鉴权插件不依赖数据源插件的话,在鉴权插件里不要在Service里把SQL写死,抽象出一个Mapper接口

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/discussionCategory issues related to discussion

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions