@tachybase/plugin-auth-saml 0.23.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +14 -0
- package/README.md +11 -0
- package/README.zh-CN.md +55 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/Options.d.ts +2 -0
- package/dist/client/SAMLButton.d.ts +5 -0
- package/dist/client/index.d.ts +5 -0
- package/dist/client/index.js +3 -0
- package/dist/client/locale/index.d.ts +3 -0
- package/dist/client/schemas/saml.d.ts +35 -0
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +31 -0
- package/dist/externalVersion.js +14 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/locale/en-US.json +26 -0
- package/dist/locale/es-ES.json +22 -0
- package/dist/locale/fr-FR.json +22 -0
- package/dist/locale/ko_KR.json +29 -0
- package/dist/locale/pt-BR.json +22 -0
- package/dist/locale/zh-CN.json +29 -0
- package/dist/node_modules/@node-saml/node-saml/LICENSE +23 -0
- package/dist/node_modules/@node-saml/node-saml/lib/algorithms.d.ts +5 -0
- package/dist/node_modules/@node-saml/node-saml/lib/algorithms.js +41 -0
- package/dist/node_modules/@node-saml/node-saml/lib/crypto.d.ts +5 -0
- package/dist/node_modules/@node-saml/node-saml/lib/crypto.js +48 -0
- package/dist/node_modules/@node-saml/node-saml/lib/datetime.d.ts +13 -0
- package/dist/node_modules/@node-saml/node-saml/lib/datetime.js +27 -0
- package/dist/node_modules/@node-saml/node-saml/lib/index.d.ts +3 -0
- package/dist/node_modules/@node-saml/node-saml/lib/index.js +9 -0
- package/dist/node_modules/@node-saml/node-saml/lib/inmemory-cache-provider.d.ts +38 -0
- package/dist/node_modules/@node-saml/node-saml/lib/inmemory-cache-provider.js +100 -0
- package/dist/node_modules/@node-saml/node-saml/lib/metadata.d.ts +2 -0
- package/dist/node_modules/@node-saml/node-saml/lib/metadata.js +112 -0
- package/dist/node_modules/@node-saml/node-saml/lib/passport-saml-types.d.ts +8 -0
- package/dist/node_modules/@node-saml/node-saml/lib/passport-saml-types.js +3 -0
- package/dist/node_modules/@node-saml/node-saml/lib/saml-post-signing.d.ts +3 -0
- package/dist/node_modules/@node-saml/node-saml/lib/saml-post-signing.js +15 -0
- package/dist/node_modules/@node-saml/node-saml/lib/saml.d.ts +75 -0
- package/dist/node_modules/@node-saml/node-saml/lib/saml.js +1005 -0
- package/dist/node_modules/@node-saml/node-saml/lib/types.d.ts +219 -0
- package/dist/node_modules/@node-saml/node-saml/lib/types.js +21 -0
- package/dist/node_modules/@node-saml/node-saml/lib/utility.d.ts +5 -0
- package/dist/node_modules/@node-saml/node-saml/lib/utility.js +27 -0
- package/dist/node_modules/@node-saml/node-saml/lib/xml.d.ts +26 -0
- package/dist/node_modules/@node-saml/node-saml/lib/xml.js +234 -0
- package/dist/node_modules/@node-saml/node-saml/package.json +1 -0
- package/dist/server/actions/getAuthUrl.d.ts +2 -0
- package/dist/server/actions/getAuthUrl.js +35 -0
- package/dist/server/actions/metadata.d.ts +2 -0
- package/dist/server/actions/metadata.js +36 -0
- package/dist/server/actions/redirect.d.ts +2 -0
- package/dist/server/actions/redirect.js +49 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +33 -0
- package/dist/server/migrations/20231008112900-update-autosignup.d.ts +6 -0
- package/dist/server/migrations/20231008112900-update-autosignup.js +52 -0
- package/dist/server/plugin.d.ts +11 -0
- package/dist/server/plugin.js +70 -0
- package/dist/server/saml-auth.d.ts +8 -0
- package/dist/server/saml-auth.js +110 -0
- package/dist/swagger/index.d.ts +137 -0
- package/dist/swagger/index.js +163 -0
- package/package.json +35 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var redirect_exports = {};
|
|
19
|
+
__export(redirect_exports, {
|
|
20
|
+
redirect: () => redirect
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(redirect_exports);
|
|
23
|
+
var import_server = require("@tachybase/server");
|
|
24
|
+
const redirect = async (ctx, next) => {
|
|
25
|
+
const { authenticator, __appName: appName } = ctx.action.params || {};
|
|
26
|
+
const { RelayState: redirect2 } = ctx.action.params.values || {};
|
|
27
|
+
let prefix = process.env.APP_PUBLIC_PATH || "";
|
|
28
|
+
if (appName && appName !== "main") {
|
|
29
|
+
const appSupervisor = import_server.AppSupervisor.getInstance();
|
|
30
|
+
if ((appSupervisor == null ? void 0 : appSupervisor.runningMode) !== "single") {
|
|
31
|
+
prefix += `/apps/${appName}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const auth = await ctx.app.authManager.get(authenticator, ctx);
|
|
35
|
+
if (prefix.endsWith("/")) {
|
|
36
|
+
prefix = prefix.slice(0, -1);
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
const { token } = await auth.signIn();
|
|
40
|
+
ctx.redirect(`${prefix}${redirect2 || "/admin"}?authenticator=${authenticator}&token=${token}`);
|
|
41
|
+
} catch (error) {
|
|
42
|
+
ctx.redirect(`${prefix}/signin?authenticator=${authenticator}&error=${error.message}&redirect=${redirect2}`);
|
|
43
|
+
}
|
|
44
|
+
await next();
|
|
45
|
+
};
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {
|
|
48
|
+
redirect
|
|
49
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => import_plugin.default
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(server_exports);
|
|
33
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var update_autosignup_exports = {};
|
|
19
|
+
__export(update_autosignup_exports, {
|
|
20
|
+
default: () => UpdateAutoSignupMigration
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(update_autosignup_exports);
|
|
23
|
+
var import_server = require("@tachybase/server");
|
|
24
|
+
var import_constants = require("../../constants");
|
|
25
|
+
class UpdateAutoSignupMigration extends import_server.Migration {
|
|
26
|
+
appVersion = "<0.14.0-alpha.8";
|
|
27
|
+
async up() {
|
|
28
|
+
const result = await this.app.version.satisfies("<=0.14.0-alpha.8");
|
|
29
|
+
if (!result) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const r = this.db.getRepository("authenticators");
|
|
33
|
+
const items = await r.find({
|
|
34
|
+
filter: {
|
|
35
|
+
authType: import_constants.authType
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
await this.db.sequelize.transaction(async (transaction) => {
|
|
39
|
+
for (const item of items) {
|
|
40
|
+
let options = item.options;
|
|
41
|
+
options = {
|
|
42
|
+
public: { autoSignup: true, ...options.public },
|
|
43
|
+
saml: { userBindField: "email", ...options.saml }
|
|
44
|
+
};
|
|
45
|
+
item.set("options", options);
|
|
46
|
+
await item.save({ transaction });
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
async down() {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { InstallOptions, Plugin } from '@tachybase/server';
|
|
2
|
+
export declare class SAMLPlugin extends Plugin {
|
|
3
|
+
afterAdd(): void;
|
|
4
|
+
beforeLoad(): void;
|
|
5
|
+
load(): Promise<void>;
|
|
6
|
+
install(options?: InstallOptions): Promise<void>;
|
|
7
|
+
afterEnable(): Promise<void>;
|
|
8
|
+
afterDisable(): Promise<void>;
|
|
9
|
+
remove(): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
export default SAMLPlugin;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var plugin_exports = {};
|
|
19
|
+
__export(plugin_exports, {
|
|
20
|
+
SAMLPlugin: () => SAMLPlugin,
|
|
21
|
+
default: () => plugin_default
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
24
|
+
var import_path = require("path");
|
|
25
|
+
var import_server = require("@tachybase/server");
|
|
26
|
+
var import_constants = require("../constants");
|
|
27
|
+
var import_getAuthUrl = require("./actions/getAuthUrl");
|
|
28
|
+
var import_metadata = require("./actions/metadata");
|
|
29
|
+
var import_redirect = require("./actions/redirect");
|
|
30
|
+
var import_saml_auth = require("./saml-auth");
|
|
31
|
+
class SAMLPlugin extends import_server.Plugin {
|
|
32
|
+
afterAdd() {
|
|
33
|
+
}
|
|
34
|
+
beforeLoad() {
|
|
35
|
+
}
|
|
36
|
+
async load() {
|
|
37
|
+
this.db.addMigrations({
|
|
38
|
+
namespace: "auth",
|
|
39
|
+
directory: (0, import_path.resolve)(__dirname, "migrations"),
|
|
40
|
+
context: {
|
|
41
|
+
plugin: this
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.app.authManager.registerTypes(import_constants.authType, {
|
|
45
|
+
auth: import_saml_auth.SAMLAuth
|
|
46
|
+
});
|
|
47
|
+
this.app.resource({
|
|
48
|
+
name: "saml",
|
|
49
|
+
actions: {
|
|
50
|
+
redirect: import_redirect.redirect,
|
|
51
|
+
metadata: import_metadata.metadata,
|
|
52
|
+
getAuthUrl: import_getAuthUrl.getAuthUrl
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
this.app.acl.allow("saml", "*", "public");
|
|
56
|
+
}
|
|
57
|
+
async install(options) {
|
|
58
|
+
}
|
|
59
|
+
async afterEnable() {
|
|
60
|
+
}
|
|
61
|
+
async afterDisable() {
|
|
62
|
+
}
|
|
63
|
+
async remove() {
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
var plugin_default = SAMLPlugin;
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {
|
|
69
|
+
SAMLPlugin
|
|
70
|
+
});
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AuthConfig, BaseAuth } from '@tachybase/auth';
|
|
2
|
+
import { SamlConfig } from '@node-saml/node-saml';
|
|
3
|
+
export { Model } from '@tachybase/database';
|
|
4
|
+
export declare class SAMLAuth extends BaseAuth {
|
|
5
|
+
constructor(config: AuthConfig);
|
|
6
|
+
getOptions(): SamlConfig;
|
|
7
|
+
validate(): Promise<import("@tachybase/database").Model<any, any>>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var saml_auth_exports = {};
|
|
19
|
+
__export(saml_auth_exports, {
|
|
20
|
+
Model: () => import_database.Model,
|
|
21
|
+
SAMLAuth: () => SAMLAuth
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(saml_auth_exports);
|
|
24
|
+
var import_auth = require("@tachybase/auth");
|
|
25
|
+
var import_node_saml = require("@node-saml/node-saml");
|
|
26
|
+
var import_database = require("@tachybase/database");
|
|
27
|
+
class SAMLAuth extends import_auth.BaseAuth {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
const { ctx } = config;
|
|
30
|
+
super({
|
|
31
|
+
...config,
|
|
32
|
+
userCollection: ctx.db.getCollection("users")
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getOptions() {
|
|
36
|
+
var _a;
|
|
37
|
+
const ctx = this.ctx;
|
|
38
|
+
const { ssoUrl, certificate, idpIssuer, http } = ((_a = this.options) == null ? void 0 : _a.saml) || {};
|
|
39
|
+
const name = this.authenticator.get("name");
|
|
40
|
+
const protocol = http ? "http" : "https";
|
|
41
|
+
return {
|
|
42
|
+
callbackUrl: `${protocol}://${ctx.host}${process.env.API_BASE_PATH}saml:redirect?authenticator=${name}&__appName=${ctx.app.name}`,
|
|
43
|
+
entryPoint: ssoUrl,
|
|
44
|
+
issuer: name,
|
|
45
|
+
cert: certificate,
|
|
46
|
+
idpIssuer,
|
|
47
|
+
wantAssertionsSigned: false
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async validate() {
|
|
51
|
+
var _a, _b;
|
|
52
|
+
const ctx = this.ctx;
|
|
53
|
+
const {
|
|
54
|
+
params: { values: samlResponse }
|
|
55
|
+
} = ctx.action;
|
|
56
|
+
const saml = new import_node_saml.SAML(this.getOptions());
|
|
57
|
+
const { profile } = await saml.validatePostResponseAsync(samlResponse);
|
|
58
|
+
const { nameID, nickname, firstName, lastName, phone } = profile;
|
|
59
|
+
let { email, username } = profile;
|
|
60
|
+
const isEmail = nameID.match(/^.+@.+\..+$/);
|
|
61
|
+
if (!email && isEmail) {
|
|
62
|
+
email = nameID;
|
|
63
|
+
}
|
|
64
|
+
if (!username && !isEmail) {
|
|
65
|
+
username = nameID;
|
|
66
|
+
}
|
|
67
|
+
const authenticator = this.authenticator;
|
|
68
|
+
let user = await authenticator.findUser(nameID);
|
|
69
|
+
if (user) {
|
|
70
|
+
return user;
|
|
71
|
+
}
|
|
72
|
+
const { userBindField = "email" } = ((_a = this.options) == null ? void 0 : _a.saml) || {};
|
|
73
|
+
if (userBindField === "email" && email) {
|
|
74
|
+
user = await this.userRepository.findOne({
|
|
75
|
+
filter: { email }
|
|
76
|
+
});
|
|
77
|
+
} else if (userBindField === "username" && username) {
|
|
78
|
+
user = await this.userRepository.findOne({
|
|
79
|
+
filter: { username }
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
if (user) {
|
|
83
|
+
await this.authenticator.addUser(user.id, {
|
|
84
|
+
through: {
|
|
85
|
+
uuid: nameID
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return user;
|
|
89
|
+
}
|
|
90
|
+
const { autoSignup } = ((_b = this.options) == null ? void 0 : _b.public) || {};
|
|
91
|
+
if (!autoSignup) {
|
|
92
|
+
throw new Error("User not found");
|
|
93
|
+
}
|
|
94
|
+
if (username && !this.validateUsername(username)) {
|
|
95
|
+
throw new Error(`Username must be 2-16 characters in length (excluding @.<>"'/)`);
|
|
96
|
+
}
|
|
97
|
+
const fullName = firstName && lastName && `${firstName} ${lastName}`;
|
|
98
|
+
return await authenticator.newUser(nameID, {
|
|
99
|
+
username: username ?? null,
|
|
100
|
+
nickname: nickname || fullName || username || nameID,
|
|
101
|
+
email: email ?? null,
|
|
102
|
+
phone: phone ?? null
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
107
|
+
0 && (module.exports = {
|
|
108
|
+
Model,
|
|
109
|
+
SAMLAuth
|
|
110
|
+
});
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
info: {
|
|
3
|
+
title: string;
|
|
4
|
+
};
|
|
5
|
+
paths: {
|
|
6
|
+
'/saml:getAuthUrl': {
|
|
7
|
+
security: any[];
|
|
8
|
+
get: {
|
|
9
|
+
description: string;
|
|
10
|
+
tags: string[];
|
|
11
|
+
parameters: {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
in: string;
|
|
15
|
+
schema: {
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
required: boolean;
|
|
19
|
+
}[];
|
|
20
|
+
responses: {
|
|
21
|
+
200: {
|
|
22
|
+
description: string;
|
|
23
|
+
content: {
|
|
24
|
+
'application/json': {
|
|
25
|
+
schema: {
|
|
26
|
+
type: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
'/auth:signIn': {
|
|
35
|
+
security: any[];
|
|
36
|
+
post: {
|
|
37
|
+
description: string;
|
|
38
|
+
tags: string[];
|
|
39
|
+
parameters: {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
in: string;
|
|
43
|
+
schema: {
|
|
44
|
+
type: string;
|
|
45
|
+
};
|
|
46
|
+
required: boolean;
|
|
47
|
+
}[];
|
|
48
|
+
requestBody: {
|
|
49
|
+
content: {
|
|
50
|
+
'application/json': {
|
|
51
|
+
schema: {
|
|
52
|
+
type: string;
|
|
53
|
+
properties: {
|
|
54
|
+
samlResponse: {
|
|
55
|
+
type: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
responses: {
|
|
63
|
+
200: {
|
|
64
|
+
description: string;
|
|
65
|
+
content: {
|
|
66
|
+
'application/json': {
|
|
67
|
+
schema: {
|
|
68
|
+
type: string;
|
|
69
|
+
properties: {
|
|
70
|
+
user: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
properties: {
|
|
74
|
+
id: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
nickname: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
email: {
|
|
83
|
+
type: string;
|
|
84
|
+
description: string;
|
|
85
|
+
};
|
|
86
|
+
phone: {
|
|
87
|
+
type: string;
|
|
88
|
+
description: string;
|
|
89
|
+
};
|
|
90
|
+
appLang: {
|
|
91
|
+
type: string;
|
|
92
|
+
description: string;
|
|
93
|
+
};
|
|
94
|
+
systemSettings: {
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
properties: {
|
|
98
|
+
theme: {
|
|
99
|
+
type: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
createdAt: {
|
|
105
|
+
type: string;
|
|
106
|
+
format: string;
|
|
107
|
+
description: string;
|
|
108
|
+
};
|
|
109
|
+
updatedAt: {
|
|
110
|
+
type: string;
|
|
111
|
+
format: string;
|
|
112
|
+
description: string;
|
|
113
|
+
};
|
|
114
|
+
createdById: {
|
|
115
|
+
type: string;
|
|
116
|
+
description: string;
|
|
117
|
+
};
|
|
118
|
+
updatedById: {
|
|
119
|
+
type: string;
|
|
120
|
+
description: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
token: {
|
|
125
|
+
type: string;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export default _default;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var swagger_exports = {};
|
|
19
|
+
__export(swagger_exports, {
|
|
20
|
+
default: () => swagger_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(swagger_exports);
|
|
23
|
+
const user = {
|
|
24
|
+
type: "object",
|
|
25
|
+
description: "\u7528\u6237",
|
|
26
|
+
properties: {
|
|
27
|
+
id: {
|
|
28
|
+
type: "integer",
|
|
29
|
+
description: "ID"
|
|
30
|
+
},
|
|
31
|
+
nickname: {
|
|
32
|
+
type: "string",
|
|
33
|
+
description: "\u6635\u79F0"
|
|
34
|
+
},
|
|
35
|
+
email: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "\u90AE\u7BB1"
|
|
38
|
+
},
|
|
39
|
+
phone: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "\u624B\u673A\u53F7"
|
|
42
|
+
},
|
|
43
|
+
appLang: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "\u7528\u6237\u4F7F\u7528\u8BED\u8A00"
|
|
46
|
+
},
|
|
47
|
+
systemSettings: {
|
|
48
|
+
type: "object",
|
|
49
|
+
description: "\u5E94\u7528\u914D\u7F6E",
|
|
50
|
+
properties: {
|
|
51
|
+
theme: {
|
|
52
|
+
type: "string",
|
|
53
|
+
description: "\u7528\u6237\u4F7F\u7528\u4E3B\u9898"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
createdAt: {
|
|
58
|
+
type: "string",
|
|
59
|
+
format: "date-time",
|
|
60
|
+
description: "\u521B\u5EFA\u65F6\u95F4"
|
|
61
|
+
},
|
|
62
|
+
updatedAt: {
|
|
63
|
+
type: "string",
|
|
64
|
+
format: "date-time",
|
|
65
|
+
description: "\u66F4\u65B0\u65F6\u95F4"
|
|
66
|
+
},
|
|
67
|
+
createdById: {
|
|
68
|
+
type: "integer",
|
|
69
|
+
description: "\u521B\u5EFA\u4EBA"
|
|
70
|
+
},
|
|
71
|
+
updatedById: {
|
|
72
|
+
type: "integer",
|
|
73
|
+
description: "\u66F4\u65B0\u4EBA"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
var swagger_default = {
|
|
78
|
+
info: {
|
|
79
|
+
title: "TachyBase API - SAML plugin"
|
|
80
|
+
},
|
|
81
|
+
paths: {
|
|
82
|
+
"/saml:getAuthUrl": {
|
|
83
|
+
security: [],
|
|
84
|
+
get: {
|
|
85
|
+
description: "Get SAML authorization url",
|
|
86
|
+
tags: ["SAML"],
|
|
87
|
+
parameters: [
|
|
88
|
+
{
|
|
89
|
+
name: "X-Authenticator",
|
|
90
|
+
description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6",
|
|
91
|
+
in: "header",
|
|
92
|
+
schema: {
|
|
93
|
+
type: "string"
|
|
94
|
+
},
|
|
95
|
+
required: true
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
responses: {
|
|
99
|
+
200: {
|
|
100
|
+
description: "ok",
|
|
101
|
+
content: {
|
|
102
|
+
"application/json": {
|
|
103
|
+
schema: {
|
|
104
|
+
type: "string"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
"/auth:signIn": {
|
|
113
|
+
security: [],
|
|
114
|
+
post: {
|
|
115
|
+
description: "SAML sign in",
|
|
116
|
+
tags: ["SAML"],
|
|
117
|
+
parameters: [
|
|
118
|
+
{
|
|
119
|
+
name: "X-Authenticator",
|
|
120
|
+
description: "\u767B\u5F55\u65B9\u5F0F\u6807\u8BC6",
|
|
121
|
+
in: "header",
|
|
122
|
+
schema: {
|
|
123
|
+
type: "string"
|
|
124
|
+
},
|
|
125
|
+
required: true
|
|
126
|
+
}
|
|
127
|
+
],
|
|
128
|
+
requestBody: {
|
|
129
|
+
content: {
|
|
130
|
+
"application/json": {
|
|
131
|
+
schema: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {
|
|
134
|
+
samlResponse: {
|
|
135
|
+
type: "string"
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
responses: {
|
|
143
|
+
200: {
|
|
144
|
+
description: "ok",
|
|
145
|
+
content: {
|
|
146
|
+
"application/json": {
|
|
147
|
+
schema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
user,
|
|
151
|
+
token: {
|
|
152
|
+
type: "string"
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tachybase/plugin-auth-saml",
|
|
3
|
+
"displayName": "Auth: SAML 2.0",
|
|
4
|
+
"version": "0.23.8",
|
|
5
|
+
"description": "SAML 2.0 authentication.",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"Authentication"
|
|
8
|
+
],
|
|
9
|
+
"license": "Apache-2.0",
|
|
10
|
+
"main": "./dist/server/index.js",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@ant-design/icons": "~5.3.7",
|
|
13
|
+
"@node-saml/node-saml": "^4.0.5",
|
|
14
|
+
"antd": "5.22.5",
|
|
15
|
+
"react": "~18.3.1",
|
|
16
|
+
"react-i18next": "^15.2.0",
|
|
17
|
+
"react-router-dom": "6.28.1",
|
|
18
|
+
"@tachybase/schema": "0.23.8"
|
|
19
|
+
},
|
|
20
|
+
"peerDependencies": {
|
|
21
|
+
"@tachybase/module-auth": "0.23.8",
|
|
22
|
+
"@tachybase/actions": "0.23.8",
|
|
23
|
+
"@tachybase/auth": "0.23.8",
|
|
24
|
+
"@tachybase/server": "0.23.8",
|
|
25
|
+
"@tachybase/test": "0.23.8",
|
|
26
|
+
"@tachybase/client": "0.23.8",
|
|
27
|
+
"@tachybase/database": "0.23.8",
|
|
28
|
+
"@tachybase/sdk": "0.23.8"
|
|
29
|
+
},
|
|
30
|
+
"description.zh-CN": "通过 SAML 2.0 协议认证身份。",
|
|
31
|
+
"displayName.zh-CN": "认证:SAML 2.0",
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tachybase-build --no-dts @tachybase/plugin-auth-saml"
|
|
34
|
+
}
|
|
35
|
+
}
|
package/server.d.ts
ADDED