From 8968cda34f99d053f2f35336733f15fb68089bda Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Sat, 13 Jan 2024 12:43:40 +0100 Subject: [PATCH] example-app: add separate auth entry point Signed-off-by: Patrik Oldsberg --- packages/app/src/auth.tsx | 71 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 packages/app/src/auth.tsx diff --git a/packages/app/src/auth.tsx b/packages/app/src/auth.tsx new file mode 100644 index 0000000000..e06df51754 --- /dev/null +++ b/packages/app/src/auth.tsx @@ -0,0 +1,71 @@ +/* + * Copyright 2020 The Backstage Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { createApp } from '@backstage/app-defaults'; +import { AppRouter } from '@backstage/core-app-api'; +import { + AlertDisplay, + OAuthRequestDialog, + SignInPage, +} from '@backstage/core-components'; +import React from 'react'; +import ReactDOM from 'react-dom/client'; +import { providers } from '../src/identityProviders'; +import { + configApiRef, + createApiFactory, + discoveryApiRef, +} from '@backstage/core-plugin-api'; +import { AuthProxyDiscoveryApi } from '../src/AuthProxyDiscoveryApi'; + +const app = createApp({ + apis: [ + createApiFactory({ + api: discoveryApiRef, + deps: { configApi: configApiRef }, + factory: ({ configApi }) => AuthProxyDiscoveryApi.fromConfig(configApi), + }), + ], + components: { + SignInPage: props => { + return ( + + ); + }, + }, +}); + +function RedirectToRoot() { + window.location.pathname += '/..'; + return
; +} + +const App = app.createRoot( + <> + + + + + + , +); + +ReactDOM.createRoot(document.getElementById('root')!).render();