export type CreateApiSystemConsoleConfigMgrComAdobeGraniteAuthSamlSamlAuthenticationHandlerArgs = {post?: boolean | undefined, apply?: boolean | undefined, delete?: boolean | undefined, action?: string | undefined, $location?: string | undefined, path?: Array | undefined, 'service.ranking'?: number | undefined, idpUrl?: string | undefined, idpCertAlias?: string | undefined, idpHttpRedirect?: boolean | undefined, serviceProviderEntityId?: string | undefined, assertionConsumerServiceURL?: string | undefined, spPrivateKeyAlias?: string | undefined, keyStorePassword?: string | undefined, defaultRedirectUrl?: string | undefined, userIDAttribute?: string | undefined, useEncryption?: boolean | undefined, createUser?: boolean | undefined, addGroupMemberships?: boolean | undefined, groupMembershipAttribute?: string | undefined, defaultGroups?: Array | undefined, nameIdFormat?: string | undefined, synchronizeAttributes?: Array | undefined, handleLogout?: boolean | undefined, logoutUrl?: string | undefined, clockTolerance?: number | undefined, digestMethod?: string | undefined, signatureMethod?: string | undefined, userIntermediatePath?: string | undefined, propertylist?: Array | undefined}; export type CreateApiSystemConsoleConfigMgrComAdobeGraniteAuthSamlSamlAuthenticationHandlerOptions = {baseUrl: string, aemAuth?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * POST /system/console/configMgr/com.adobe.granite.auth.saml.SamlAuthenticationHandler */ export const createApiSystemConsoleConfigMgrComAdobeGraniteAuthSamlSamlAuthenticationHandler = async (args: CreateApiSystemConsoleConfigMgrComAdobeGraniteAuthSamlSamlAuthenticationHandlerArgs, options: CreateApiSystemConsoleConfigMgrComAdobeGraniteAuthSamlSamlAuthenticationHandlerOptions) => { const {baseUrl, fetch: fetchFn = fetch, aemAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") if (args.post != null) query.append("post", String(args.post)) if (args.apply != null) query.append("apply", String(args.apply)) if (args.delete != null) query.append("delete", String(args.delete)) if (args.action != null) query.append("action", String(args.action)) if (args.$location != null) query.append("$location", String(args.$location)) for (const item of args.path ?? []) query.append("path", String(item)) if (args['service.ranking'] != null) query.append("service.ranking", String(args['service.ranking'])) if (args.idpUrl != null) query.append("idpUrl", String(args.idpUrl)) if (args.idpCertAlias != null) query.append("idpCertAlias", String(args.idpCertAlias)) if (args.idpHttpRedirect != null) query.append("idpHttpRedirect", String(args.idpHttpRedirect)) if (args.serviceProviderEntityId != null) query.append("serviceProviderEntityId", String(args.serviceProviderEntityId)) if (args.assertionConsumerServiceURL != null) query.append("assertionConsumerServiceURL", String(args.assertionConsumerServiceURL)) if (args.spPrivateKeyAlias != null) query.append("spPrivateKeyAlias", String(args.spPrivateKeyAlias)) if (args.keyStorePassword != null) query.append("keyStorePassword", String(args.keyStorePassword)) if (args.defaultRedirectUrl != null) query.append("defaultRedirectUrl", String(args.defaultRedirectUrl)) if (args.userIDAttribute != null) query.append("userIDAttribute", String(args.userIDAttribute)) if (args.useEncryption != null) query.append("useEncryption", String(args.useEncryption)) if (args.createUser != null) query.append("createUser", String(args.createUser)) if (args.addGroupMemberships != null) query.append("addGroupMemberships", String(args.addGroupMemberships)) if (args.groupMembershipAttribute != null) query.append("groupMembershipAttribute", String(args.groupMembershipAttribute)) for (const item of args.defaultGroups ?? []) query.append("defaultGroups", String(item)) if (args.nameIdFormat != null) query.append("nameIdFormat", String(args.nameIdFormat)) for (const item of args.synchronizeAttributes ?? []) query.append("synchronizeAttributes", String(item)) if (args.handleLogout != null) query.append("handleLogout", String(args.handleLogout)) if (args.logoutUrl != null) query.append("logoutUrl", String(args.logoutUrl)) if (args.clockTolerance != null) query.append("clockTolerance", String(args.clockTolerance)) if (args.digestMethod != null) query.append("digestMethod", String(args.digestMethod)) if (args.signatureMethod != null) query.append("signatureMethod", String(args.signatureMethod)) if (args.userIntermediatePath != null) query.append("userIntermediatePath", String(args.userIntermediatePath)) if (args.propertylist != null) query.append("propertylist", args.propertylist.join(',')) if (aemAuth !== undefined) headers.set('authorization', `Basic ${btoa(`${aemAuth.username}:${aemAuth.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/system/console/configMgr/com.adobe.granite.auth.saml.SamlAuthenticationHandler${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };