@hawk.so/types 0.3.0 → 0.4.0
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/build/index.d.ts +1 -0
- package/build/index.js +1 -0
- package/build/src/dbScheme/sso.d.ts +77 -0
- package/build/src/dbScheme/sso.js +5 -0
- package/build/src/dbScheme/user.d.ts +20 -0
- package/build/src/dbScheme/workspace.d.ts +5 -0
- package/index.ts +1 -0
- package/package.json +1 -1
- package/src/dbScheme/sso.ts +88 -0
- package/src/dbScheme/user.ts +22 -0
- package/src/dbScheme/workspace.ts +6 -0
package/build/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export * from "./src/dbScheme/user";
|
|
|
23
23
|
export * from "./src/dbScheme/userNotifications";
|
|
24
24
|
export * from "./src/dbScheme/workspace";
|
|
25
25
|
export * from "./src/dbScheme/bankCard";
|
|
26
|
+
export * from "./src/dbScheme/sso";
|
|
26
27
|
export * from "./src/dbScheme/projectEventGroupingPattern";
|
|
27
28
|
export * from "./src/notifications/createProjectNotifications";
|
|
28
29
|
export * from "./src/notifications/receiveTypes";
|
package/build/index.js
CHANGED
|
@@ -39,6 +39,7 @@ __exportStar(require("./src/dbScheme/user"), exports);
|
|
|
39
39
|
__exportStar(require("./src/dbScheme/userNotifications"), exports);
|
|
40
40
|
__exportStar(require("./src/dbScheme/workspace"), exports);
|
|
41
41
|
__exportStar(require("./src/dbScheme/bankCard"), exports);
|
|
42
|
+
__exportStar(require("./src/dbScheme/sso"), exports);
|
|
42
43
|
__exportStar(require("./src/dbScheme/projectEventGroupingPattern"), exports);
|
|
43
44
|
__exportStar(require("./src/notifications/createProjectNotifications"), exports);
|
|
44
45
|
__exportStar(require("./src/notifications/receiveTypes"), exports);
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSO configuration types for database schema
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* SAML attribute mapping configuration
|
|
6
|
+
*/
|
|
7
|
+
export interface SamlAttributeMapping {
|
|
8
|
+
/**
|
|
9
|
+
* Attribute name for email in SAML Assertion
|
|
10
|
+
* @example "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
|
|
11
|
+
* to get email from XML like this:
|
|
12
|
+
* <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
|
|
13
|
+
* <AttributeValue>alice@company.com</AttributeValue>
|
|
14
|
+
* </Attribute>
|
|
15
|
+
*/
|
|
16
|
+
email: string;
|
|
17
|
+
/**
|
|
18
|
+
* Attribute name for user name in SAML Assertion
|
|
19
|
+
*/
|
|
20
|
+
name?: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* SAML SSO configuration
|
|
24
|
+
*/
|
|
25
|
+
export interface SamlConfig {
|
|
26
|
+
/**
|
|
27
|
+
* IdP Entity ID.
|
|
28
|
+
* Used to validate "this response is intended for Hawk"
|
|
29
|
+
* @example "urn:hawk:tracker:saml"
|
|
30
|
+
*/
|
|
31
|
+
idpEntityId: string;
|
|
32
|
+
/**
|
|
33
|
+
* SSO URL for redirecting user to IdP
|
|
34
|
+
* Used to redirect user to IdP for authentication
|
|
35
|
+
* @example "https://idp.example.com/sso"
|
|
36
|
+
*/
|
|
37
|
+
ssoUrl: string;
|
|
38
|
+
/**
|
|
39
|
+
* X.509 certificate for signature verification
|
|
40
|
+
* @example "-----BEGIN CERTIFICATE-----\nMIIDYjCCAkqgAwIBAgI...END CERTIFICATE-----"
|
|
41
|
+
*/
|
|
42
|
+
x509Cert: string;
|
|
43
|
+
/**
|
|
44
|
+
* Desired NameID format
|
|
45
|
+
* @example "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
|
|
46
|
+
*/
|
|
47
|
+
nameIdFormat?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Attribute mapping configuration
|
|
50
|
+
* Used to extract user attributes from SAML Response
|
|
51
|
+
*/
|
|
52
|
+
attributeMapping: SamlAttributeMapping;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* SSO configuration for workspace
|
|
56
|
+
*/
|
|
57
|
+
export interface WorkspaceSsoConfig {
|
|
58
|
+
/**
|
|
59
|
+
* Is SSO enabled
|
|
60
|
+
*/
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Is SSO enforced (only SSO login allowed)
|
|
64
|
+
* If true, login via email/password is not allowed
|
|
65
|
+
*/
|
|
66
|
+
enforced: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* SSO provider type
|
|
69
|
+
* Currently only SAML is supported. In future we can add other providers (OAuth 2, etc.)
|
|
70
|
+
*/
|
|
71
|
+
type: 'saml';
|
|
72
|
+
/**
|
|
73
|
+
* SAML-specific configuration.
|
|
74
|
+
* Got from IdP metadata.
|
|
75
|
+
*/
|
|
76
|
+
saml: SamlConfig;
|
|
77
|
+
}
|
|
@@ -67,4 +67,24 @@ export interface UserDBScheme {
|
|
|
67
67
|
*/
|
|
68
68
|
term?: string;
|
|
69
69
|
};
|
|
70
|
+
/**
|
|
71
|
+
* External identities for SSO (keyed by workspaceId)
|
|
72
|
+
*/
|
|
73
|
+
identities?: {
|
|
74
|
+
[workspaceId: string]: {
|
|
75
|
+
/**
|
|
76
|
+
* SAML-mode params
|
|
77
|
+
*/
|
|
78
|
+
saml: {
|
|
79
|
+
/**
|
|
80
|
+
* NameID value from IdP (stable identifier)
|
|
81
|
+
*/
|
|
82
|
+
id: string;
|
|
83
|
+
/**
|
|
84
|
+
* Email at the time of linking (for audit)
|
|
85
|
+
*/
|
|
86
|
+
email: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
};
|
|
70
90
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ObjectId } from 'bson';
|
|
2
|
+
import type { WorkspaceSsoConfig } from './sso.ts';
|
|
2
3
|
/**
|
|
3
4
|
* Workspace representation in DataBase
|
|
4
5
|
*/
|
|
@@ -68,4 +69,8 @@ export interface WorkspaceDBScheme {
|
|
|
68
69
|
lastNotificationDate?: {
|
|
69
70
|
[key: string]: Date;
|
|
70
71
|
};
|
|
72
|
+
/**
|
|
73
|
+
* SSO configuration (optional, only for workspaces with SSO enabled)
|
|
74
|
+
*/
|
|
75
|
+
sso?: WorkspaceSsoConfig;
|
|
71
76
|
}
|
package/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export * from "./src/dbScheme/user";
|
|
|
28
28
|
export * from "./src/dbScheme/userNotifications";
|
|
29
29
|
export * from "./src/dbScheme/workspace";
|
|
30
30
|
export * from "./src/dbScheme/bankCard";
|
|
31
|
+
export * from "./src/dbScheme/sso";
|
|
31
32
|
export * from "./src/dbScheme/projectEventGroupingPattern";
|
|
32
33
|
|
|
33
34
|
export * from "./src/notifications/createProjectNotifications";
|
package/package.json
CHANGED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSO configuration types for database schema
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* SAML attribute mapping configuration
|
|
7
|
+
*/
|
|
8
|
+
export interface SamlAttributeMapping {
|
|
9
|
+
/**
|
|
10
|
+
* Attribute name for email in SAML Assertion
|
|
11
|
+
* @example "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress"
|
|
12
|
+
* to get email from XML like this:
|
|
13
|
+
* <Attribute Name="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress">
|
|
14
|
+
* <AttributeValue>alice@company.com</AttributeValue>
|
|
15
|
+
* </Attribute>
|
|
16
|
+
*/
|
|
17
|
+
email: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Attribute name for user name in SAML Assertion
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* SAML SSO configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface SamlConfig {
|
|
29
|
+
/**
|
|
30
|
+
* IdP Entity ID.
|
|
31
|
+
* Used to validate "this response is intended for Hawk"
|
|
32
|
+
* @example "urn:hawk:tracker:saml"
|
|
33
|
+
*/
|
|
34
|
+
idpEntityId: string;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* SSO URL for redirecting user to IdP
|
|
38
|
+
* Used to redirect user to IdP for authentication
|
|
39
|
+
* @example "https://idp.example.com/sso"
|
|
40
|
+
*/
|
|
41
|
+
ssoUrl: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* X.509 certificate for signature verification
|
|
45
|
+
* @example "-----BEGIN CERTIFICATE-----\nMIIDYjCCAkqgAwIBAgI...END CERTIFICATE-----"
|
|
46
|
+
*/
|
|
47
|
+
x509Cert: string;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Desired NameID format
|
|
51
|
+
* @example "urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress"
|
|
52
|
+
*/
|
|
53
|
+
nameIdFormat?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Attribute mapping configuration
|
|
57
|
+
* Used to extract user attributes from SAML Response
|
|
58
|
+
*/
|
|
59
|
+
attributeMapping: SamlAttributeMapping;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* SSO configuration for workspace
|
|
64
|
+
*/
|
|
65
|
+
export interface WorkspaceSsoConfig {
|
|
66
|
+
/**
|
|
67
|
+
* Is SSO enabled
|
|
68
|
+
*/
|
|
69
|
+
enabled: boolean;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Is SSO enforced (only SSO login allowed)
|
|
73
|
+
* If true, login via email/password is not allowed
|
|
74
|
+
*/
|
|
75
|
+
enforced: boolean;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* SSO provider type
|
|
79
|
+
* Currently only SAML is supported. In future we can add other providers (OAuth 2, etc.)
|
|
80
|
+
*/
|
|
81
|
+
type: 'saml';
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* SAML-specific configuration.
|
|
85
|
+
* Got from IdP metadata.
|
|
86
|
+
*/
|
|
87
|
+
saml: SamlConfig;
|
|
88
|
+
}
|
package/src/dbScheme/user.ts
CHANGED
|
@@ -81,4 +81,26 @@ export interface UserDBScheme {
|
|
|
81
81
|
*/
|
|
82
82
|
term?: string;
|
|
83
83
|
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* External identities for SSO (keyed by workspaceId)
|
|
87
|
+
*/
|
|
88
|
+
identities?: {
|
|
89
|
+
[workspaceId: string]: {
|
|
90
|
+
/**
|
|
91
|
+
* SAML-mode params
|
|
92
|
+
*/
|
|
93
|
+
saml: {
|
|
94
|
+
/**
|
|
95
|
+
* NameID value from IdP (stable identifier)
|
|
96
|
+
*/
|
|
97
|
+
id: string;
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Email at the time of linking (for audit)
|
|
101
|
+
*/
|
|
102
|
+
email: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
};
|
|
84
106
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ObjectId } from 'bson';
|
|
2
|
+
import type { WorkspaceSsoConfig } from './sso.ts';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Workspace representation in DataBase
|
|
@@ -81,4 +82,9 @@ export interface WorkspaceDBScheme {
|
|
|
81
82
|
* Used to reduce frequency of some system messages
|
|
82
83
|
*/
|
|
83
84
|
lastNotificationDate?: { [key: string]: Date };
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* SSO configuration (optional, only for workspaces with SSO enabled)
|
|
88
|
+
*/
|
|
89
|
+
sso?: WorkspaceSsoConfig;
|
|
84
90
|
}
|