-
Notifications
You must be signed in to change notification settings - Fork 451
Expand file tree
/
Copy pathEnterpriseConnection.ts
More file actions
204 lines (198 loc) · 5.86 KB
/
EnterpriseConnection.ts
File metadata and controls
204 lines (198 loc) · 5.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
import type {
EnterpriseConnectionJSON,
EnterpriseConnectionOauthConfigJSON,
EnterpriseConnectionSamlConnectionJSON,
} from './JSON';
/**
* The Backend `EnterpriseConnectionSamlConnection` object holds information about a SAML enterprise connection for an instance or organization.
*/
export class EnterpriseConnectionSamlConnection {
constructor(
/**
* The unique identifier for the SAML connection.
*/
readonly id: string,
/**
* The name to use as a label for the connection.
*/
readonly name: string,
/**
* The Entity ID as provided by the Identity Provider (IdP).
*/
readonly idpEntityId: string,
/**
* The Single-Sign On URL as provided by the Identity Provider (IdP).
*/
readonly idpSsoUrl: string,
/**
* The X.509 certificate as provided by the Identity Provider (IdP).
*/
readonly idpCertificate: string,
/**
* The URL which serves the Identity Provider (IdP) metadata.
*/
readonly idpMetadataUrl: string,
/**
* The XML content of the Identity Provider (IdP) metadata file.
*/
readonly idpMetadata: string,
/**
* The Assertion Consumer Service (ACS) URL of the connection.
*/
readonly acsUrl: string,
/**
* The Entity ID as provided by the Service Provider (Clerk).
*/
readonly spEntityId: string,
/**
* The metadata URL as provided by the Service Provider (Clerk).
*/
readonly spMetadataUrl: string,
/**
* Indicates whether the connection syncs user attributes between the IdP and Clerk.
*/
readonly syncUserAttributes: boolean,
/**
* Indicates whether users with an email address subdomain are allowed to use this connection.
*/
readonly allowSubdomains: boolean,
/**
* Indicates whether Identity Provider (IdP) initiated flows are allowed.
*/
readonly allowIdpInitiated: boolean,
) {}
static fromJSON(data: EnterpriseConnectionSamlConnectionJSON): EnterpriseConnectionSamlConnection {
return new EnterpriseConnectionSamlConnection(
data.id,
data.name,
data.idp_entity_id,
data.idp_sso_url,
data.idp_certificate,
data.idp_metadata_url,
data.idp_metadata,
data.acs_url,
data.sp_entity_id,
data.sp_metadata_url,
data.sync_user_attributes,
data.allow_subdomains,
data.allow_idp_initiated,
);
}
}
/**
* OAuth configuration included on a Backend API {@link EnterpriseConnection} response.
*/
export class EnterpriseConnectionOauthConfig {
constructor(
/**
* The unique identifier for the OAuth configuration.
*/
readonly id: string,
/**
* The name to use as a label for the configuration.
*/
readonly name: string,
/**
* The OAuth client ID.
*/
readonly clientId: string,
/**
* The OpenID Connect discovery URL.
*/
readonly discoveryUrl: string,
/**
* The public URL of the OAuth provider logo, if available.
*/
readonly logoPublicUrl: string,
/**
* The date when the configuration was first created.
*/
readonly createdAt: number,
/**
* The date when the configuration was last updated.
*/
readonly updatedAt: number,
) {}
static fromJSON(data: EnterpriseConnectionOauthConfigJSON): EnterpriseConnectionOauthConfig {
return new EnterpriseConnectionOauthConfig(
data.id,
data.name,
data.client_id,
data.discovery_url,
data.logo_public_url,
data.created_at,
data.updated_at,
);
}
}
/**
* The Backend `EnterpriseConnection` object holds information about an enterprise connection (SAML or OAuth) for an instance or organization.
*/
export class EnterpriseConnection {
constructor(
/**
* The unique identifier for the connection.
*/
readonly id: string,
/**
* The name to use as a label for the connection.
*/
readonly name: string,
/**
* The domain of the enterprise. Sign-in flows using an email with this domain may use the connection.
*/
readonly domains: Array<string>,
/**
* The Organization ID if the connection is scoped to an organization.
*/
readonly organizationId: string | null,
/**
* Indicates whether the connection is active or not.
*/
readonly active: boolean,
/**
* Indicates whether the connection syncs user attributes between the IdP and Clerk or not.
*/
readonly syncUserAttributes: boolean,
/**
* Indicates whether users with an email address subdomain are allowed to use this connection or not.
*/
readonly allowSubdomains: boolean,
/**
* Indicates whether additional identifications are disabled for this connection.
*/
readonly disableAdditionalIdentifications: boolean,
/**
* The date when the connection was first created.
*/
readonly createdAt: number,
/**
* The date when the connection was last updated.
*/
readonly updatedAt: number,
/**
* SAML connection details when the enterprise connection uses SAML.
*/
readonly samlConnection: EnterpriseConnectionSamlConnection | null,
/**
* OAuth (OIDC) configuration when the enterprise connection uses OAuth.
*/
readonly oauthConfig: EnterpriseConnectionOauthConfig | null,
) {}
static fromJSON(data: EnterpriseConnectionJSON): EnterpriseConnection {
return new EnterpriseConnection(
data.id,
data.name,
data.domains,
data.organization_id,
data.active,
data.sync_user_attributes,
data.allow_subdomains,
data.disable_additional_identifications,
data.created_at,
data.updated_at,
data.saml_connection != null ? EnterpriseConnectionSamlConnection.fromJSON(data.saml_connection) : null,
data.oauth_config != null ? EnterpriseConnectionOauthConfig.fromJSON(data.oauth_config) : null,
);
}
}