YANG QIA 8b88b29b5e
test: add backend unit tests (#4000)
* test: add backend unit tests

* test: cas

* test: oidc & saml

* test: sql collection

* fix: test files

* test: data-visualization

* test: localization

* fix: test
2024-04-16 17:56:48 +08:00

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;