Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Commit

Permalink
Use new shared auth components for oidc support.
Browse files Browse the repository at this point in the history
  • Loading branch information
EricWittmann committed Jan 25, 2024
1 parent 1510fb4 commit 8dea197
Show file tree
Hide file tree
Showing 45 changed files with 280 additions and 979 deletions.
4 changes: 2 additions & 2 deletions ui/ui-app/configs/config-3scale.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const ApiDesignerConfig = {
"navPrefixPath": ""
},
"apis": {
"designer": "https://apicurio-designer-api-rhaf-apicurio.apps.dev-eng-ocp4-mas.dev.3sca.net/apis/designer/v0"
"designer": "https://designer-api.dev.apicur.io/apis/designer/v0"
},
"components": {
"masthead": {
Expand All @@ -24,7 +24,7 @@ const ApiDesignerConfig = {
"options": {
"redirectUri": "http://localhost:8888",
"clientId": "designer-ui",
"url": "https://keycloak-rhaf-apicurio.apps.dev-eng-ocp4-mas.dev.3sca.net/realms/apicurio"
"url": "https://sso.dev.apicur.io/realms/apicurio"
}
}
};
15 changes: 8 additions & 7 deletions ui/ui-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion ui/ui-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"vite-tsconfig-paths": "4.3.1"
},
"dependencies": {
"@apicurio/common-ui-components": "1.0.11",
"@apicurio/common-ui-components": "1.0.14",
"@monaco-editor/react": "4.6.0",
"@patternfly/patternfly": "5.1.0",
"@patternfly/react-core": "5.1.2",
Expand Down
61 changes: 16 additions & 45 deletions ui/ui-app/src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,58 +4,29 @@ import "@patternfly/patternfly/patternfly-addons.css";

import React from "react";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import { useOidcAuth } from "@app/auth";
import { ApiDesignerConfigContext, ApiDesignerConfigType } from "@app/contexts/config";

import { AuthConfig } from "@services/ServiceConfigContext.tsx";
import { EditorPage, EmbeddedEditorPage, HomePage, PageConfig, PageContextProvider } from "@app/pages";
import { AppHeader, ApplicationAuth } from "@app/components";
import { EditorPage, EmbeddedEditorPage, HomePage } from "@app/pages";
import { AppHeader } from "@app/components";
import { Page } from "@patternfly/react-core";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
const apiDesignerConfig: ApiDesignerConfigType = ApiDesignerConfig || window["ApiDesignerConfig"];
import { ApiDesignerConfig, useApiDesignerConfig } from "@services/useApiDesignerConfig.ts";
import { ApplicationAuth, AuthConfigContext, AuthConfig } from "@apicurio/common-ui-components";


export const App: React.FunctionComponent = () => {
const auth: AuthConfig = useOidcAuth();

const editorsUrl: string = apiDesignerConfig.components.editors.url.startsWith("/") ?
(window.location.origin + apiDesignerConfig.components.editors.url) :
apiDesignerConfig.components.editors.url;

const pageConfig: PageConfig = {
editorConfig: {
openApiEditorUrl: editorsUrl,
asyncApiEditorUrl: editorsUrl
},
serviceConfig: {
designs: {
type: apiDesignerConfig.apis.designer === "browser" ? "browser" : "api",
api: apiDesignerConfig.apis.designer
},
navigation: {
basename: apiDesignerConfig.ui.navPrefixPath
},
auth
}
};
const appConfig: ApiDesignerConfig = useApiDesignerConfig();

return (
<ApiDesignerConfigContext.Provider value={apiDesignerConfig}>
<AuthConfigContext.Provider value={appConfig.auth as AuthConfig}>
<ApplicationAuth>
<PageContextProvider value={pageConfig}>
<Router basename={apiDesignerConfig.ui.contextPath}>
<Page className="pf-m-redhat-font" isManagedSidebar={false} header={<AppHeader />}>
<Routes>
<Route path="/" element={<HomePage />}/>
<Route path="/designs/:designId/editor" element={<EditorPage />}/>
<Route path="/editor-embedded" element={<EmbeddedEditorPage />}/>
</Routes>
</Page>
</Router>
</PageContextProvider>
<Router basename={appConfig.ui.contextPath}>
<Page className="pf-m-redhat-font" isManagedSidebar={false} header={<AppHeader />}>
<Routes>
<Route path="/" element={<HomePage />}/>
<Route path="/designs/:designId/editor" element={<EditorPage />}/>
<Route path="/editor-embedded" element={<EmbeddedEditorPage />}/>
</Routes>
</Page>
</Router>
</ApplicationAuth>
</ApiDesignerConfigContext.Provider>
</AuthConfigContext.Provider>
);
};
2 changes: 0 additions & 2 deletions ui/ui-app/src/app/auth/index.ts

This file was deleted.

23 changes: 0 additions & 23 deletions ui/ui-app/src/app/auth/oidc/OidcContext.tsx

This file was deleted.

142 changes: 0 additions & 142 deletions ui/ui-app/src/app/auth/oidc/oidcAuth.ts

This file was deleted.

62 changes: 0 additions & 62 deletions ui/ui-app/src/app/components/auth/ApplicationAuth.tsx

This file was deleted.

Loading

0 comments on commit 8dea197

Please sign in to comment.