mirror of
https://github.com/nextcloud/server.git
synced 2026-02-03 20:41:22 -05:00
1 line
No EOL
2.8 KiB
Text
1 line
No EOL
2.8 KiB
Text
{"version":3,"file":"files_external-init_settings.mjs","sources":["../build/frontend/apps/files_external/src/services/AuthMachanism.ts","../build/frontend/apps/files_external/src/init-settings.ts"],"sourcesContent":["/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport type { IAuthMechanism } from '../types.ts'\n\nimport logger from '../utils/logger.ts'\n\ninterface IAuthConfigHandler {\n\t/**\n\t * Unique identifier for the auth mechanism handler\n\t */\n\tid: string\n\n\t/**\n\t * Tag name used to register the web component.\n\t *\n\t * The registered web component must have the following props:\n\t * - `authMechanism`: The auth mechanism configuration object {see IAuthMechanism}\n\t * - `modelValue`: The current configuration values as an object\n\t *\n\t * The web component must emit the following events:\n\t * - `update:modelValue`: Emitted when the configuration values change, with the new values as detail\n\t *\n\t * @see https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements\n\t */\n\ttagName: string\n\n\t/**\n\t * Check if the auth mechanism is enabled\n\t *\n\t * @param authMechanism - The auth mechanism selected\n\t */\n\tenabled(authMechanism: IAuthMechanism): boolean\n}\n\nexport class AuthMechanism {\n\t#registeredAuthMechanisms = new Map<string, IAuthConfigHandler>()\n\n\t/**\n\t * Register a custom auth mechanism handler\n\t *\n\t * @param authMechanism - The auth mechanism to register\n\t */\n\tregisterHandler(authMechanism: IAuthConfigHandler) {\n\t\tif (this.#registeredAuthMechanisms.has(authMechanism.id)) {\n\t\t\tlogger.warn(`Auth mechanism handler with id '${authMechanism.id}' is already registered`)\n\t\t}\n\t\tthis.#registeredAuthMechanisms.set(authMechanism.id, authMechanism)\n\t}\n\n\t/**\n\t * Get the handler for a given auth mechanism\n\t *\n\t * @param authMechanism - The auth mechanism to get the handler for\n\t */\n\tgetHandler(authMechanism: IAuthMechanism): IAuthConfigHandler | undefined {\n\t\treturn this.#registeredAuthMechanisms.values().find((handler) => handler.enabled(authMechanism))\n\t}\n}\n","/*!\n * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors\n * SPDX-License-Identifier: AGPL-3.0-or-later\n */\n\nimport { AuthMechanism } from './services/AuthMachanism.ts'\n\nwindow.OCA.FilesExternal ??= {}\nwindow.OCA.FilesExternal.AuthMechanism = new AuthMechanism()\n"],"names":["AuthMechanism","#registeredAuthMechanisms","authMechanism","logger","handler"],"mappings":"mFAqCO,MAAMA,CAAc,CAC1BC,OAAgC,IAOhC,gBAAgBC,EAAmC,CAC9C,KAAKD,GAA0B,IAAIC,EAAc,EAAE,GACtDC,EAAO,KAAK,mCAAmCD,EAAc,EAAE,yBAAyB,EAEzF,KAAKD,GAA0B,IAAIC,EAAc,GAAIA,CAAa,CACnE,CAOA,WAAWA,EAA+D,CACzE,OAAO,KAAKD,GAA0B,SAAS,KAAMG,GAAYA,EAAQ,QAAQF,CAAa,CAAC,CAChG,CACD,CCrDA,OAAO,IAAI,gBAAkB,CAAA,EAC7B,OAAO,IAAI,cAAc,cAAgB,IAAIF"} |