mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-01 18:52:20 +08:00
* test: add backend unit tests * test: cas * test: oidc & saml * test: sql collection * fix: test files * test: data-visualization * test: localization * fix: test
49 lines
984 B
TypeScript
49 lines
984 B
TypeScript
import { InstallOptions, Plugin } from '@nocobase/server';
|
|
import { getAuthUrl } from './actions/getAuthUrl';
|
|
import { redirect } from './actions/redirect';
|
|
import { SAMLAuth } from './saml-auth';
|
|
import { authType } from '../constants';
|
|
import { resolve } from 'path';
|
|
|
|
export class PluginSAMLServer extends Plugin {
|
|
afterAdd() {}
|
|
|
|
beforeLoad() {}
|
|
|
|
async load() {
|
|
this.db.addMigrations({
|
|
namespace: 'auth',
|
|
directory: resolve(__dirname, 'migrations'),
|
|
context: {
|
|
plugin: this,
|
|
},
|
|
});
|
|
|
|
this.app.authManager.registerTypes(authType, {
|
|
auth: SAMLAuth,
|
|
});
|
|
|
|
// 注册接口
|
|
this.app.resource({
|
|
name: 'saml',
|
|
actions: {
|
|
redirect,
|
|
getAuthUrl,
|
|
},
|
|
});
|
|
|
|
// 开放访问权限
|
|
this.app.acl.allow('saml', '*', 'public');
|
|
}
|
|
|
|
async install(options?: InstallOptions) {}
|
|
|
|
async afterEnable() {}
|
|
|
|
async afterDisable() {}
|
|
|
|
async remove() {}
|
|
}
|
|
|
|
export default PluginSAMLServer;
|