-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking a part the auth providers from main index
- Loading branch information
Showing
5 changed files
with
152 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { Router } from "react-router-dom"; | ||
import { createTheme, ThemeProvider } from "@material-ui/core"; | ||
import { Auth0Provider } from "@auth0/auth0-react"; | ||
import AppAuth0 from "./containers/AppAuth0"; | ||
import { history } from "./utils/historyUtils"; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
secondary: { | ||
main: "#fff", | ||
}, | ||
}, | ||
}); | ||
|
||
/* istanbul ignore next */ | ||
const onRedirectCallback = (appState: any) => { | ||
history.replace((appState && appState.returnTo) || window.location.pathname); | ||
}; | ||
|
||
const root = createRoot(document.getElementById("root")!); | ||
|
||
/* istanbul ignore if */ | ||
if (process.env.VITE_APP_AUTH0) { | ||
root.render( | ||
<Auth0Provider | ||
domain={process.env.VITE_APP_AUTH0_DOMAIN!} | ||
clientId={process.env.VITE_APP_AUTH0_CLIENTID!} | ||
redirectUri={window.location.origin} | ||
audience={process.env.VITE_APP_AUTH0_AUDIENCE} | ||
scope={process.env.VITE_APP_AUTH0_SCOPE} | ||
onRedirectCallback={onRedirectCallback} | ||
cacheLocation="localstorage" | ||
> | ||
<Router history={history}> | ||
<ThemeProvider theme={theme}> | ||
<AppAuth0 /> | ||
</ThemeProvider> | ||
</Router> | ||
</Auth0Provider> | ||
); | ||
} else { | ||
console.error("Auth0 is not configured."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { Router } from "react-router-dom"; | ||
import { createTheme, ThemeProvider } from "@material-ui/core"; | ||
|
||
import AppCognito from "./containers/AppCognito"; | ||
import { history } from "./utils/historyUtils"; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
secondary: { | ||
main: "#fff", | ||
}, | ||
}, | ||
}); | ||
|
||
const root = createRoot(document.getElementById("root")!); | ||
|
||
if (process.env.VITE_APP_AWS_COGNITO) { | ||
/* istanbul ignore next */ | ||
root.render( | ||
<Router history={history}> | ||
<ThemeProvider theme={theme}> | ||
<AppCognito /> | ||
</ThemeProvider> | ||
</Router> | ||
); | ||
} else { | ||
console.error("Cogntio is not configured."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { Router } from "react-router-dom"; | ||
import { createTheme, ThemeProvider } from "@material-ui/core"; | ||
|
||
import AppGoogle from "./containers/AppGoogle"; | ||
import { history } from "./utils/historyUtils"; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
secondary: { | ||
main: "#fff", | ||
}, | ||
}, | ||
}); | ||
|
||
const root = createRoot(document.getElementById("root")!); | ||
|
||
if (process.env.VITE_APP_GOOGLE) { | ||
/* istanbul ignore next */ | ||
root.render( | ||
<Router history={history}> | ||
<ThemeProvider theme={theme}> | ||
<AppGoogle /> | ||
</ThemeProvider> | ||
</Router> | ||
); | ||
} else { | ||
console.error("Google is not configured."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React from "react"; | ||
import { createRoot } from "react-dom/client"; | ||
import { Router } from "react-router-dom"; | ||
import { createTheme, ThemeProvider } from "@material-ui/core"; | ||
|
||
// @ts-ignore | ||
import { OktaAuth } from "@okta/okta-auth-js"; | ||
import { Security } from "@okta/okta-react"; | ||
import { history } from "./utils/historyUtils"; | ||
import AppOkta from "./containers/AppOkta"; | ||
|
||
const theme = createTheme({ | ||
palette: { | ||
secondary: { | ||
main: "#fff", | ||
}, | ||
}, | ||
}); | ||
|
||
const root = createRoot(document.getElementById("root")!); | ||
|
||
if (process.env.VITE_APP_OKTA) { | ||
const oktaAuth = new OktaAuth({ | ||
issuer: `https://${process.env.VITE_APP_OKTA_DOMAIN}/oauth2/default`, | ||
clientId: process.env.VITE_APP_OKTA_CLIENTID, | ||
redirectUri: window.location.origin + "/implicit/callback", | ||
}); | ||
/* istanbul ignore next */ | ||
root.render( | ||
<Router history={history}> | ||
<ThemeProvider theme={theme}> | ||
<Security oktaAuth={oktaAuth}> | ||
<AppOkta /> | ||
</Security> | ||
</ThemeProvider> | ||
</Router> | ||
); | ||
} else { | ||
console.error("Okta is not configured."); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters