ts-mailcow-api 1.4.0 → 1.6.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/README.md +1 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -1
- package/dist/endpoints/identity-provider-endpoints.d.ts +27 -0
- package/dist/endpoints/identity-provider-endpoints.js +23 -0
- package/dist/endpoints/identity-provider-endpoints.js.map +1 -0
- package/dist/endpoints/quarantine-endpoints.d.ts +8 -1
- package/dist/endpoints/quarantine-endpoints.js +4 -0
- package/dist/endpoints/quarantine-endpoints.js.map +1 -1
- package/dist/types.d.ts +234 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,7 @@ at a typed interface documented in the
|
|
|
92
92
|
| `domains` | Domains |
|
|
93
93
|
| `fail2Ban` | Fail2Ban configuration |
|
|
94
94
|
| `forwardingHosts` | Forwarding hosts |
|
|
95
|
+
| `identityProvider` | External IdP (Keycloak/LDAP/OIDC) |
|
|
95
96
|
| `logs` | ACME, API, dovecot, postfix, ... |
|
|
96
97
|
| `mailbox` | Mailboxes (and ACL, pushover, ...)|
|
|
97
98
|
| `oauth2` | OAuth2 clients |
|
package/dist/client.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ import { TlsPolicyMapEndpoints } from './endpoints/tls-policy-map-endpoints';
|
|
|
23
23
|
import { DkimEndpoints } from './endpoints/dkim-endpoints';
|
|
24
24
|
import { DomainAdminEndpoints } from './endpoints/domain-admin-endpoints';
|
|
25
25
|
import { RoutingEndpoints } from './endpoints/routing-endpoints';
|
|
26
|
+
import { IdentityProviderEndpoints } from './endpoints/identity-provider-endpoints';
|
|
26
27
|
/**
|
|
27
28
|
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
28
29
|
* @external
|
|
@@ -174,5 +175,12 @@ declare class MailcowClient {
|
|
|
174
175
|
* @external
|
|
175
176
|
*/
|
|
176
177
|
routing: RoutingEndpoints;
|
|
178
|
+
/**
|
|
179
|
+
* Endpoint for configuring the external Identity Provider (Keycloak,
|
|
180
|
+
* LDAP, or a generic OIDC provider).
|
|
181
|
+
* See {@link IdentityProviderEndpoints}
|
|
182
|
+
* @external
|
|
183
|
+
*/
|
|
184
|
+
identityProvider: IdentityProviderEndpoints;
|
|
177
185
|
}
|
|
178
186
|
export default MailcowClient;
|
package/dist/client.js
CHANGED
|
@@ -24,6 +24,7 @@ const tls_policy_map_endpoints_1 = require("./endpoints/tls-policy-map-endpoints
|
|
|
24
24
|
const dkim_endpoints_1 = require("./endpoints/dkim-endpoints");
|
|
25
25
|
const domain_admin_endpoints_1 = require("./endpoints/domain-admin-endpoints");
|
|
26
26
|
const routing_endpoints_1 = require("./endpoints/routing-endpoints");
|
|
27
|
+
const identity_provider_endpoints_1 = require("./endpoints/identity-provider-endpoints");
|
|
27
28
|
/**
|
|
28
29
|
* Class containing all the logic to interface with the Mailcow API in TypeScript.
|
|
29
30
|
* @external
|
|
@@ -186,6 +187,13 @@ class MailcowClient {
|
|
|
186
187
|
* @external
|
|
187
188
|
*/
|
|
188
189
|
routing = (0, routing_endpoints_1.routingEndpoints)(this);
|
|
190
|
+
/**
|
|
191
|
+
* Endpoint for configuring the external Identity Provider (Keycloak,
|
|
192
|
+
* LDAP, or a generic OIDC provider).
|
|
193
|
+
* See {@link IdentityProviderEndpoints}
|
|
194
|
+
* @external
|
|
195
|
+
*/
|
|
196
|
+
identityProvider = (0, identity_provider_endpoints_1.identityProviderEndpoints)(this);
|
|
189
197
|
}
|
|
190
198
|
exports.default = MailcowClient;
|
|
191
199
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAGH,mEAAgF;AAChF,uEAAsF;AACtF,mEAAkF;AAClF,uDAA+C;AAC/C,iEAA6E;AAC7E,qEAAmF;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CAAC,CAAC;IAEvE;;;;OAIG;IACI,aAAa,GAA0B,IAAA,gDAAqB,EAAC,IAAI,CAAC,CAAC;IAE1E;;;;OAIG;IACI,IAAI,GAAkB,IAAA,8BAAa,EAAC,IAAI,CAAC,CAAC;IAEjD;;;;OAIG;IACI,YAAY,GAAyB,IAAA,6CAAoB,EAAC,IAAI,CAAC,CAAC;IAEvE;;;;OAIG;IACI,OAAO,GAAqB,IAAA,oCAAgB,EAAC,IAAI,CAAC,CAAC;IAE1D;;;;;OAKG;IACI,gBAAgB,GAA8B,IAAA,uDAAyB,EAAC,IAAI,CAAC,CAAC;CACtF;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import MailcowClient from '../index';
|
|
2
|
+
import { IdentityProviderAttributes, MailcowResponse } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Interface for the external Identity Provider endpoint.
|
|
5
|
+
*
|
|
6
|
+
* Mailcow has a single global identity-provider configuration -- there
|
|
7
|
+
* is no add or delete, only edit -- so this group exposes a single
|
|
8
|
+
* method.
|
|
9
|
+
*/
|
|
10
|
+
export interface IdentityProviderEndpoints {
|
|
11
|
+
/**
|
|
12
|
+
* Configure (or reconfigure) the external Identity Provider used for
|
|
13
|
+
* Mailcow login. Pass the attributes for one of the supported
|
|
14
|
+
* `authsource` values; the wrapper supplies the required
|
|
15
|
+
* `items: ['identity-provider']` envelope.
|
|
16
|
+
*
|
|
17
|
+
* @param attr - The identity-provider attributes to apply.
|
|
18
|
+
*/
|
|
19
|
+
edit(attr: IdentityProviderAttributes): Promise<MailcowResponse>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Binder function between the MailcowClient class and the
|
|
23
|
+
* IdentityProviderEndpoints.
|
|
24
|
+
* @param bind - The MailcowClient to bind.
|
|
25
|
+
* @internal
|
|
26
|
+
*/
|
|
27
|
+
export declare function identityProviderEndpoints(bind: MailcowClient): IdentityProviderEndpoints;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.identityProviderEndpoints = identityProviderEndpoints;
|
|
4
|
+
const IDENTITY_PROVIDER_ENDPOINTS = {
|
|
5
|
+
EDIT: 'edit/identity-provider',
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Binder function between the MailcowClient class and the
|
|
9
|
+
* IdentityProviderEndpoints.
|
|
10
|
+
* @param bind - The MailcowClient to bind.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
function identityProviderEndpoints(bind) {
|
|
14
|
+
return {
|
|
15
|
+
edit(attr) {
|
|
16
|
+
return bind.requestFactory.post(IDENTITY_PROVIDER_ENDPOINTS.EDIT, {
|
|
17
|
+
attr,
|
|
18
|
+
items: ['identity-provider'],
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=identity-provider-endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity-provider-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/identity-provider-endpoints.ts"],"names":[],"mappings":";;AAgCA,8DASC;AAnBD,MAAM,2BAA2B,GAAG;IAClC,IAAI,EAAE,wBAAwB;CAC/B,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,IAAmB;IAC3D,OAAO;QACL,IAAI,CAAC,IAAgC;YACnC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA+C,2BAA2B,CAAC,IAAI,EAAE;gBAC9G,IAAI;gBACJ,KAAK,EAAE,CAAC,mBAAmB,CAAC;aAC7B,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DeleteQuarantineRequest, MailcowResponse, QuarantineItem } from '../types';
|
|
1
|
+
import { DeleteQuarantineRequest, EditQuarantineItemRequest, MailcowResponse, QuarantineItem } from '../types';
|
|
2
2
|
import MailcowClient from '../index';
|
|
3
3
|
/**
|
|
4
4
|
* Interface for all Quarantine endpoints related to email handling in Mailcow.
|
|
@@ -10,6 +10,13 @@ export interface QuarantineEndpoints {
|
|
|
10
10
|
* @returns A promise that resolves to the Mailcow API response indicating success or failure.
|
|
11
11
|
*/
|
|
12
12
|
delete(payload: DeleteQuarantineRequest): Promise<MailcowResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* Acts on quarantined emails: release them to the recipient's inbox
|
|
15
|
+
* or learn them as ham to improve future Rspamd filtering.
|
|
16
|
+
* @param payload - The IDs to act on and the action to take.
|
|
17
|
+
* @returns A promise that resolves to the Mailcow API response indicating success or failure.
|
|
18
|
+
*/
|
|
19
|
+
edit(payload: EditQuarantineItemRequest): Promise<MailcowResponse>;
|
|
13
20
|
/**
|
|
14
21
|
* Retrieves all emails currently held in quarantine.
|
|
15
22
|
* @returns A promise that resolves to an array of `QuarantineItem` representing each quarantined email.
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.quarantineEndpoints = quarantineEndpoints;
|
|
4
4
|
const QUARANTINE_ENDPOINTS = {
|
|
5
5
|
DELETE: 'delete/qitem',
|
|
6
|
+
EDIT: 'edit/qitem',
|
|
6
7
|
GET: 'get/quarantine/all',
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
@@ -15,6 +16,9 @@ function quarantineEndpoints(bind) {
|
|
|
15
16
|
delete(payload) {
|
|
16
17
|
return bind.requestFactory.post(QUARANTINE_ENDPOINTS.DELETE, payload.items);
|
|
17
18
|
},
|
|
19
|
+
edit(payload) {
|
|
20
|
+
return bind.requestFactory.post(QUARANTINE_ENDPOINTS.EDIT, payload);
|
|
21
|
+
},
|
|
18
22
|
get() {
|
|
19
23
|
return bind.requestFactory.get(QUARANTINE_ENDPOINTS.GET);
|
|
20
24
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"quarantine-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/quarantine-endpoints.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"quarantine-endpoints.js","sourceRoot":"","sources":["../../src/endpoints/quarantine-endpoints.ts"],"names":[],"mappings":";;AAwCA,kDAYC;AAvBD,MAAM,oBAAoB,GAAG;IAC3B,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,oBAAoB;CAC1B,CAAC;AAEF;;;;GAIG;AACH,SAAgB,mBAAmB,CAAC,IAAmB;IACrD,OAAO;QACL,MAAM,CAAC,OAAgC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA4B,oBAAoB,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;QACzG,CAAC;QACD,IAAI,CAAC,OAAkC;YACrC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,CAA6C,oBAAoB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClH,CAAC;QACD,GAAG;YACD,OAAO,IAAI,CAAC,cAAc,CAAC,GAAG,CAAmB,oBAAoB,CAAC,GAAG,CAAC,CAAC;QAC7E,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1687,6 +1687,33 @@ export interface DeleteQuarantineRequest {
|
|
|
1687
1687
|
*/
|
|
1688
1688
|
items: number[];
|
|
1689
1689
|
}
|
|
1690
|
+
/**
|
|
1691
|
+
* Action to take on a quarantined email via `edit/qitem`.
|
|
1692
|
+
*
|
|
1693
|
+
* - `release` -- deliver the email to the original recipient's inbox.
|
|
1694
|
+
* - `learnham` -- mark the email as ham and feed it back to Rspamd as
|
|
1695
|
+
* a training sample. Useful for false positives.
|
|
1696
|
+
*
|
|
1697
|
+
* The quarantine queue is already presumed-spam by definition, so there
|
|
1698
|
+
* is no `learnspam` counterpart -- Mailcow does not document one.
|
|
1699
|
+
*/
|
|
1700
|
+
export type QuarantineItemAction = 'release' | 'learnham';
|
|
1701
|
+
/**
|
|
1702
|
+
* Request payload for `edit/qitem`.
|
|
1703
|
+
*
|
|
1704
|
+
* The `items` array holds the IDs of the quarantined messages to act
|
|
1705
|
+
* on; the same `attr.action` is applied to every entry.
|
|
1706
|
+
*/
|
|
1707
|
+
export interface EditQuarantineItemRequest {
|
|
1708
|
+
/**
|
|
1709
|
+
* IDs of the quarantined messages to act on. Get them from
|
|
1710
|
+
* `mcc.quarantine.get()`.
|
|
1711
|
+
*/
|
|
1712
|
+
items: number[];
|
|
1713
|
+
attr: {
|
|
1714
|
+
action: QuarantineItemAction;
|
|
1715
|
+
};
|
|
1716
|
+
}
|
|
1690
1717
|
/**
|
|
1691
1718
|
* Request payload to edit rate limits for specified domains.
|
|
1692
1719
|
*/
|
|
@@ -2246,6 +2273,213 @@ export interface TransportMap {
|
|
|
2246
2273
|
*/
|
|
2247
2274
|
username: string;
|
|
2248
2275
|
}
|
|
2276
|
+
/**
|
|
2277
|
+
* Identity Provider authentication source.
|
|
2278
|
+
*
|
|
2279
|
+
* Mailcow's external authentication backends. `mailcow` (the built-in
|
|
2280
|
+
* local password database) is not configurable via this endpoint and is
|
|
2281
|
+
* therefore not part of this union.
|
|
2282
|
+
*/
|
|
2283
|
+
export type IdentityProviderAuthsource = 'ldap' | 'keycloak' | 'generic-oidc';
|
|
2284
|
+
/**
|
|
2285
|
+
* Attributes shared across every identity-provider configuration,
|
|
2286
|
+
* regardless of which auth source it targets.
|
|
2287
|
+
*/
|
|
2288
|
+
export interface BaseIdentityProviderAttributes {
|
|
2289
|
+
/**
|
|
2290
|
+
* If no matching attribute mapping exists for a user, the default template
|
|
2291
|
+
* is used when creating the mailbox (not on update). Mailcow expects the
|
|
2292
|
+
* template name as configured under "Mailbox templates".
|
|
2293
|
+
*/
|
|
2294
|
+
default_template?: string;
|
|
2295
|
+
/**
|
|
2296
|
+
* Attribute values used to match a mailbox template. Each element pairs
|
|
2297
|
+
* positionally with `templates` -- the n-th `mappers` entry selects the
|
|
2298
|
+
* n-th `templates` entry.
|
|
2299
|
+
*/
|
|
2300
|
+
mappers?: string[];
|
|
2301
|
+
/**
|
|
2302
|
+
* Mailbox template names. See `mappers` for how the two arrays are
|
|
2303
|
+
* correlated.
|
|
2304
|
+
*/
|
|
2305
|
+
templates?: string[];
|
|
2306
|
+
/**
|
|
2307
|
+
* Skip TLS certificate validation when contacting the auth source.
|
|
2308
|
+
* @defaultValue false
|
|
2309
|
+
*/
|
|
2310
|
+
ignore_ssl_error?: boolean;
|
|
2311
|
+
/**
|
|
2312
|
+
* Whether Mailcow should periodically pull every user from the auth
|
|
2313
|
+
* source. Defaults to `false`; combine with `sync_interval` and
|
|
2314
|
+
* `import_users` to enable scheduled syncs.
|
|
2315
|
+
* @defaultValue false
|
|
2316
|
+
*/
|
|
2317
|
+
periodic_sync?: boolean;
|
|
2318
|
+
/**
|
|
2319
|
+
* Whether new users discovered during a sync should be imported into
|
|
2320
|
+
* Mailcow as mailboxes.
|
|
2321
|
+
* @defaultValue false
|
|
2322
|
+
*/
|
|
2323
|
+
import_users?: boolean;
|
|
2324
|
+
/**
|
|
2325
|
+
* Interval, in minutes, between periodic syncs.
|
|
2326
|
+
* @defaultValue 15
|
|
2327
|
+
*/
|
|
2328
|
+
sync_interval?: number;
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Identity provider attributes for an external Keycloak server.
|
|
2332
|
+
*/
|
|
2333
|
+
export interface KeycloakIdentityProviderAttributes extends BaseIdentityProviderAttributes {
|
|
2334
|
+
authsource: 'keycloak';
|
|
2335
|
+
/**
|
|
2336
|
+
* Base URL of the Keycloak server (no trailing slash needed).
|
|
2337
|
+
*/
|
|
2338
|
+
server_url: string;
|
|
2339
|
+
/**
|
|
2340
|
+
* Keycloak realm where the Mailcow client is configured.
|
|
2341
|
+
*/
|
|
2342
|
+
realm: string;
|
|
2343
|
+
/**
|
|
2344
|
+
* Client ID of the Mailcow OIDC client inside the realm.
|
|
2345
|
+
*/
|
|
2346
|
+
client_id: string;
|
|
2347
|
+
/**
|
|
2348
|
+
* Client secret paired with `client_id`. Sent back from Mailcow as
|
|
2349
|
+
* `"*"` once configured.
|
|
2350
|
+
*/
|
|
2351
|
+
client_secret: string;
|
|
2352
|
+
/**
|
|
2353
|
+
* Primary redirect URL configured for the Mailcow client in Keycloak.
|
|
2354
|
+
*/
|
|
2355
|
+
redirect_url: string;
|
|
2356
|
+
/**
|
|
2357
|
+
* Additional accepted redirect URLs.
|
|
2358
|
+
*/
|
|
2359
|
+
redirect_url_extra?: string[];
|
|
2360
|
+
/**
|
|
2361
|
+
* Keycloak version (for example `26.1.3`). Mailcow uses this to pick
|
|
2362
|
+
* the right admin API shape internally.
|
|
2363
|
+
*/
|
|
2364
|
+
version: string;
|
|
2365
|
+
/**
|
|
2366
|
+
* Validate user passwords via the Keycloak admin REST API instead of
|
|
2367
|
+
* relying only on the Authorization Code Flow. Required for IMAP/SMTP
|
|
2368
|
+
* to keep working when Keycloak is the source of truth for passwords.
|
|
2369
|
+
* @defaultValue false
|
|
2370
|
+
*/
|
|
2371
|
+
mailpassword_flow?: boolean;
|
|
2372
|
+
}
|
|
2373
|
+
/**
|
|
2374
|
+
* Identity provider attributes for an external LDAP / Active Directory
|
|
2375
|
+
* server.
|
|
2376
|
+
*/
|
|
2377
|
+
export interface LdapIdentityProviderAttributes extends BaseIdentityProviderAttributes {
|
|
2378
|
+
authsource: 'ldap';
|
|
2379
|
+
/**
|
|
2380
|
+
* Hostname (or comma-separated list of hostnames for fallback) of the
|
|
2381
|
+
* LDAP server.
|
|
2382
|
+
*/
|
|
2383
|
+
host: string;
|
|
2384
|
+
/**
|
|
2385
|
+
* LDAP port as a string.
|
|
2386
|
+
*/
|
|
2387
|
+
port: string;
|
|
2388
|
+
/**
|
|
2389
|
+
* Use LDAPS. If `port` is 389 it is forced to 636.
|
|
2390
|
+
* @defaultValue false
|
|
2391
|
+
*/
|
|
2392
|
+
use_ssl?: boolean;
|
|
2393
|
+
/**
|
|
2394
|
+
* Use StartTLS. Mutually exclusive with `use_ssl`; preferred over SSL.
|
|
2395
|
+
* @defaultValue false
|
|
2396
|
+
*/
|
|
2397
|
+
use_tls?: boolean;
|
|
2398
|
+
/**
|
|
2399
|
+
* Base DN under which user searches are performed.
|
|
2400
|
+
*/
|
|
2401
|
+
basedn: string;
|
|
2402
|
+
/**
|
|
2403
|
+
* LDAP attribute used to identify users at login.
|
|
2404
|
+
* @defaultValue 'mail'
|
|
2405
|
+
*/
|
|
2406
|
+
username_field?: string;
|
|
2407
|
+
/**
|
|
2408
|
+
* Optional LDAP search filter to limit who may authenticate.
|
|
2409
|
+
*/
|
|
2410
|
+
filter?: string;
|
|
2411
|
+
/**
|
|
2412
|
+
* LDAP attribute whose value Mailcow maps to a mailbox template via
|
|
2413
|
+
* `mappers` / `templates`.
|
|
2414
|
+
*/
|
|
2415
|
+
attribute_field: string;
|
|
2416
|
+
/**
|
|
2417
|
+
* Bind DN used to perform user searches.
|
|
2418
|
+
*/
|
|
2419
|
+
binddn: string;
|
|
2420
|
+
/**
|
|
2421
|
+
* Password for `binddn`.
|
|
2422
|
+
*/
|
|
2423
|
+
bindpass: string;
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* Identity provider attributes for an arbitrary OIDC provider that is
|
|
2427
|
+
* not Keycloak (Authentik, Auth0, Okta, ...).
|
|
2428
|
+
*/
|
|
2429
|
+
export interface GenericOidcIdentityProviderAttributes extends BaseIdentityProviderAttributes {
|
|
2430
|
+
authsource: 'generic-oidc';
|
|
2431
|
+
/**
|
|
2432
|
+
* Authorization endpoint URL.
|
|
2433
|
+
*/
|
|
2434
|
+
authorize_url: string;
|
|
2435
|
+
/**
|
|
2436
|
+
* Token endpoint URL.
|
|
2437
|
+
*/
|
|
2438
|
+
token_url: string;
|
|
2439
|
+
/**
|
|
2440
|
+
* Userinfo endpoint URL.
|
|
2441
|
+
*/
|
|
2442
|
+
userinfo_url: string;
|
|
2443
|
+
/**
|
|
2444
|
+
* Client ID issued by the OIDC provider.
|
|
2445
|
+
*/
|
|
2446
|
+
client_id: string;
|
|
2447
|
+
/**
|
|
2448
|
+
* Client secret issued by the OIDC provider.
|
|
2449
|
+
*/
|
|
2450
|
+
client_secret: string;
|
|
2451
|
+
/**
|
|
2452
|
+
* Primary redirect URL registered with the provider.
|
|
2453
|
+
*/
|
|
2454
|
+
redirect_url: string;
|
|
2455
|
+
/**
|
|
2456
|
+
* Additional accepted redirect URLs.
|
|
2457
|
+
*/
|
|
2458
|
+
redirect_url_extra?: string[];
|
|
2459
|
+
/**
|
|
2460
|
+
* Space-separated list of OIDC scopes requested at login.
|
|
2461
|
+
* @defaultValue 'openid profile email mailcow_template'
|
|
2462
|
+
*/
|
|
2463
|
+
client_scopes?: string;
|
|
2464
|
+
}
|
|
2465
|
+
/**
|
|
2466
|
+
* Discriminated union of every supported identity-provider
|
|
2467
|
+
* configuration. The `authsource` field is the discriminant.
|
|
2468
|
+
*/
|
|
2469
|
+
export type IdentityProviderAttributes = KeycloakIdentityProviderAttributes | LdapIdentityProviderAttributes | GenericOidcIdentityProviderAttributes;
|
|
2470
|
+
/**
|
|
2471
|
+
* Wire-level body of the `edit/identity-provider` request. The wrapper
|
|
2472
|
+
* builds this for you from {@link IdentityProviderAttributes}, but it
|
|
2473
|
+
* is exported in case callers need to construct it manually.
|
|
2474
|
+
*
|
|
2475
|
+
* `items` is always `['identity-provider']` -- the array type is used
|
|
2476
|
+
* (rather than a fixed tuple) so callers do not have to use a `const`
|
|
2477
|
+
* assertion to satisfy this interface.
|
|
2478
|
+
*/
|
|
2479
|
+
export interface IdentityProviderEditRequest {
|
|
2480
|
+
attr: IdentityProviderAttributes;
|
|
2481
|
+
items: 'identity-provider'[];
|
|
2482
|
+
}
|
|
2249
2483
|
/**
|
|
2250
2484
|
* Interface for a general Mailcow API response.
|
|
2251
2485
|
*
|