Quick Start

1 Data source structure

There are two types of data tables in MatrixAuth. One is the management data table, which has three records for data source, cache, business application and other information; the other is the RBAC data table, which has six records for the application role permission relationship of business application.

According to the different data tables contained, there are two types of data sources in MatrixAuth:

  • Default data source: includes management data table and RBAC data table. MatrixAuth has only one default data source. When a business application does not have a data source set, the RBAC table in the default data source is used to serve the business application.
  • RBAC data source: contains only RBAC class data tables. MatrixAuth supports the management of zero or more RBAC data sources. Business applications can select this type of data source to store their own user role permission information. A RBAC data source can be shared by multiple business applications.

Here is the data source structure of MatrixAuth:

2 Default data source

MatrixAuth has and has only one default data source.

The default data source requires the following statement to initialize nine data tables.

application:

create table application
(
    name varchar(255) not null
        primary key,
    token varchar(255) null,
    dataSourceName varchar(255) null,
    cacheName varchar(255) null
);

datasource:

create table datasource
(
    name varchar(255) not null
        primary key,
    url text not null,
    driver varchar(255) null,
    userName varchar(255) null,
    password varchar(255) null
);

cache:

create table cache
(
    name varchar(255) not null
        primary key,
    url varchar(255) not null,
    password varchar(255) null
);

user:

create table user
(
    appName varchar(255) not null,
    `key` varchar(255) not null,
    name varchar(255) null,
    primary key (appName, `key`)
);

user_x_role:

create table user_x_role
(
    appName varchar(255) not null,
    userKey varchar(255) not null,
    roleName varchar(255) not null,
    primary key (appName, userKey, roleName)
);

role:

create table role
(
    appName varchar(255) not null,
    name varchar(255) not null,
    type varchar(255) not null,
    description text null,
    primary key (appName, name)
);

role_x_permission:

create table role_x_permission
(
    appName varchar(255) not null,
    roleName varchar(255) not null,
    permKey varchar(255) not null,
    primary key (appName, roleName, permKey)
);

permission:

create table permission
(
    appName varchar(255) not null,
    `key` varchar(255) not null,
    name varchar(255) null,
    description text null,
    primary key (appName, `key`)
);

user_x_permission:

create table user_x_permission
(
    fullUserKey varchar(255) not null
        primary key,
    permissionKeys text null
);

3 RBAC data sources

MatrixAuth can manage zero or more RBAC data sources.

The RBAC data source needs to initialize six data tables with the following statement.

user:

create table user
(
    appName varchar(255) not null,
    `key` varchar(255) not null,
    name varchar(255) null,
    primary key (appName, `key`)
);

user_x_role:

create table user_x_role
(
    appName varchar(255) not null,
    userKey varchar(255) not null,
    roleName varchar(255) not null,
    primary key (appName, userKey, roleName)
);

role:

create table role
(
    appName varchar(255) not null,
    name varchar(255) not null,
    type varchar(255) not null,
    description text null,
    primary key (appName, name)
);

role_x_permission:

create table role_x_permission
(
    appName varchar(255) not null,
    roleName varchar(255) not null,
    permKey varchar(255) not null,
    primary key (appName, roleName, permKey)
);

permission:

create table permission
(
    appName varchar(255) not null,
    `key` varchar(255) not null,
    name varchar(255) null,
    description text null,
    primary key (appName, `key`)
);

user_x_permission:

create table user_x_permission
(
    fullUserKey varchar(255) not null
        primary key,
    permissionKeys text null
);

MatrixAuth-High performance lightweight distributed permission system.