1- import type { EnterpriseConnectionJSON } from './JSON' ;
1+ import type {
2+ EnterpriseConnectionJSON ,
3+ EnterpriseConnectionOauthConfigJSON ,
4+ EnterpriseConnectionSamlConnectionJSON ,
5+ } from './JSON' ;
6+
7+ export class EnterpriseConnectionSamlConnection {
8+ constructor (
9+ /**
10+ * The unique identifier for the SAML connection.
11+ */
12+ readonly id : string ,
13+ /**
14+ * The name to use as a label for the connection.
15+ */
16+ readonly name : string ,
17+ /**
18+ * The Entity ID as provided by the Identity Provider (IdP).
19+ */
20+ readonly idpEntityId : string ,
21+ /**
22+ * The Single-Sign On URL as provided by the Identity Provider (IdP).
23+ */
24+ readonly idpSsoUrl : string ,
25+ /**
26+ * The X.509 certificate as provided by the Identity Provider (IdP).
27+ */
28+ readonly idpCertificate : string ,
29+ /**
30+ * The URL which serves the Identity Provider (IdP) metadata.
31+ */
32+ readonly idpMetadataUrl : string ,
33+ /**
34+ * The XML content of the Identity Provider (IdP) metadata file.
35+ */
36+ readonly idpMetadata : string ,
37+ /**
38+ * The Assertion Consumer Service (ACS) URL of the connection.
39+ */
40+ readonly acsUrl : string ,
41+ /**
42+ * The Entity ID as provided by the Service Provider (Clerk).
43+ */
44+ readonly spEntityId : string ,
45+ /**
46+ * The metadata URL as provided by the Service Provider (Clerk).
47+ */
48+ readonly spMetadataUrl : string ,
49+ /**
50+ * Indicates whether the connection syncs user attributes between the IdP and Clerk.
51+ */
52+ readonly syncUserAttributes : boolean ,
53+ /**
54+ * Indicates whether users with an email address subdomain are allowed to use this connection.
55+ */
56+ readonly allowSubdomains : boolean ,
57+ /**
58+ * Indicates whether Identity Provider (IdP) initiated flows are allowed.
59+ */
60+ readonly allowIdpInitiated : boolean ,
61+ ) { }
62+
63+ static fromJSON ( data : EnterpriseConnectionSamlConnectionJSON ) : EnterpriseConnectionSamlConnection {
64+ return new EnterpriseConnectionSamlConnection (
65+ data . id ,
66+ data . name ,
67+ data . idp_entity_id ,
68+ data . idp_sso_url ,
69+ data . idp_certificate ,
70+ data . idp_metadata_url ,
71+ data . idp_metadata ,
72+ data . acs_url ,
73+ data . sp_entity_id ,
74+ data . sp_metadata_url ,
75+ data . sync_user_attributes ,
76+ data . allow_subdomains ,
77+ data . allow_idp_initiated ,
78+ ) ;
79+ }
80+ }
81+
82+ /**
83+ * OAuth configuration included on a Backend API {@link EnterpriseConnection} response.
84+ */
85+ export class EnterpriseConnectionOauthConfig {
86+ constructor (
87+ /**
88+ * The unique identifier for the OAuth configuration.
89+ */
90+ readonly id : string ,
91+ /**
92+ * The name to use as a label for the configuration.
93+ */
94+ readonly name : string ,
95+ /**
96+ * The OAuth client ID.
97+ */
98+ readonly clientId : string ,
99+ /**
100+ * The OpenID Connect discovery URL.
101+ */
102+ readonly discoveryUrl : string ,
103+ /**
104+ * The public URL of the OAuth provider logo, if available.
105+ */
106+ readonly logoPublicUrl : string ,
107+ /**
108+ * The date when the configuration was first created.
109+ */
110+ readonly createdAt : number ,
111+ /**
112+ * The date when the configuration was last updated.
113+ */
114+ readonly updatedAt : number ,
115+ ) { }
116+
117+ static fromJSON ( data : EnterpriseConnectionOauthConfigJSON ) : EnterpriseConnectionOauthConfig {
118+ return new EnterpriseConnectionOauthConfig (
119+ data . id ,
120+ data . name ,
121+ data . client_id ,
122+ data . discovery_url ,
123+ data . logo_public_url ,
124+ data . created_at ,
125+ data . updated_at ,
126+ ) ;
127+ }
128+ }
2129
3130/**
4131 * The Backend `EnterpriseConnection` object holds information about an enterprise connection (SAML or OAuth) for an instance or organization.
@@ -45,6 +172,14 @@ export class EnterpriseConnection {
45172 * The date when the connection was last updated.
46173 */
47174 readonly updatedAt : number ,
175+ /**
176+ * SAML connection details when the enterprise connection uses SAML.
177+ */
178+ readonly samlConnection : EnterpriseConnectionSamlConnection | null ,
179+ /**
180+ * OAuth (OIDC) configuration when the enterprise connection uses OAuth.
181+ */
182+ readonly oauthConfig : EnterpriseConnectionOauthConfig | null ,
48183 ) { }
49184
50185 static fromJSON ( data : EnterpriseConnectionJSON ) : EnterpriseConnection {
@@ -59,6 +194,8 @@ export class EnterpriseConnection {
59194 data . disable_additional_identifications ,
60195 data . created_at ,
61196 data . updated_at ,
197+ data . saml_connection != null ? EnterpriseConnectionSamlConnection . fromJSON ( data . saml_connection ) : null ,
198+ data . oauth_config != null ? EnterpriseConnectionOauthConfig . fromJSON ( data . oauth_config ) : null ,
62199 ) ;
63200 }
64201}
0 commit comments