feat: remove sso if disabled on Unraid-API start

This commit is contained in:
Eli Bosley
2025-01-27 10:06:06 -05:00
parent 632775e435
commit daf904bc1b
2 changed files with 9 additions and 7 deletions

View File

@@ -15,6 +15,7 @@ import { WebSocket } from 'ws';
import { logger } from '@app/core/log'; import { logger } from '@app/core/log';
import { setupLogRotation } from '@app/core/logrotate/setup-logrotate'; import { setupLogRotation } from '@app/core/logrotate/setup-logrotate';
import { setupAuthRequest } from '@app/core/sso/auth-request-setup'; import { setupAuthRequest } from '@app/core/sso/auth-request-setup';
import { removeSso } from '@app/core/sso/sso-remove';
import { setupSso } from '@app/core/sso/sso-setup'; import { setupSso } from '@app/core/sso/sso-setup';
import { fileExistsSync } from '@app/core/utils/files/file-exists'; import { fileExistsSync } from '@app/core/utils/files/file-exists';
import { environment, PORT } from '@app/environment'; import { environment, PORT } from '@app/environment';
@@ -100,15 +101,18 @@ try {
startMiddlewareListeners(); startMiddlewareListeners();
// If the config contains SSO IDs, enable SSO // If the config contains SSO IDs, enable SSO
if (store.getState().config.remote.ssoSubIds) { try {
try { if (store.getState().config.remote.ssoSubIds) {
await setupAuthRequest(); await setupAuthRequest();
await setupSso(); await setupSso();
} catch (err) { logger.info('SSO setup complete');
logger.error(err, 'Failed to setup SSO'); } else {
await removeSso();
logger.info('SSO removed');
} }
} catch (err) {
logger.error('Failed to setup SSO with error: %o', err);
} }
// On process exit stop HTTP server // On process exit stop HTTP server
exitHook((signal) => { exitHook((signal) => {
console.log('exithook', signal); console.log('exithook', signal);

View File

@@ -2,8 +2,6 @@
import { ArrowDownTrayIcon, ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/solid'; import { ArrowDownTrayIcon, ArrowTopRightOnSquareIcon } from '@heroicons/vue/24/solid';
import { BrandButton } from '@unraid/ui'; import { BrandButton } from '@unraid/ui';
import { CONNECT_FORUMS, CONTACT, DISCORD, WEBGUI_GRAPHQL } from '~/helpers/urls'; import { CONNECT_FORUMS, CONTACT, DISCORD, WEBGUI_GRAPHQL } from '~/helpers/urls';
import { useServerStore } from '~/store/server';
import { storeToRefs } from 'pinia';
import { useI18n } from 'vue-i18n'; import { useI18n } from 'vue-i18n';
const { t } = useI18n(); const { t } = useI18n();