This repository has been archived by the owner on Jan 11, 2023. It is now read-only.
generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add keycloak authentication (#28)
* feat: add keycloak integration * feat: add token to requests * feat: add user roles to components * feat: add env vars to dockerfile * feat: add missing env vars to docker build args * feat: add console log to catch possible errors * feat: add log and promise handler to app start * feat: update onload keycloak init property * Revert "feat: update onload keycloak init property" This reverts commit 71c9284. * feat: add react-keycloak-web dependency and provider * feat: updated provier do be injected in a better place * test: disabled failing tests for now * feat: remove duplicated parameter * doc: add docker steps to build and run the app * feat: tests now passing and working * feat: sonar cloud smells and reports * feat: add event and token logger to test app behavior * feat: add pop-up login - partial * feat: open login popup - partial * feat: add popup login * feat: add login provider enum * feat: remove console log and improve error handling * feat: handle authenticated condition at header component * feat: manual login handling * feat: login without popup * Empty commit to trigger workflows * feat: get token from context * feat: fix header and sample pages styling * test: BCHeader component test passing * test: App rendering test passing * test: userTable component test passing * feat: app auth provider in the right place * feat: minor improvements * feat: new version with check-sso route - testing * feat: remove console log statements * feat: add logout component * feat: restore unrelated files, delete unused files, minor improvements I decided to restore two files related to Cypress testing since this is not in the target for now. Also deleted two files related to Layout, however no Layout is not in use anymore. Also improved exports of the AuthContext component to have a better reading. * feat: fix typos and comments * feat: add env vars to build time * fix: adding support for env after build adding env vars support after build * fix: fixing react-inject-env folder * feat: add new line to solve lint warning * feat: add write permission to create env file Co-authored-by: Paulo Gomes da Cruz Jr <[email protected]>
- Loading branch information
Ricardo Campos
and
Paulo Gomes da Cruz Jr
authored
Dec 2, 2022
1 parent
40be9ec
commit ee0bd69
Showing
38 changed files
with
958 additions
and
391 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
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
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
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
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 |
---|---|---|
|
@@ -39,4 +39,4 @@ | |
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
yarn-error.log* |
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 |
---|---|---|
@@ -1,11 +1,13 @@ | ||
FROM node:16-bullseye | ||
LABEL maintainer="Paulo Gomes da Cruz Junior <[email protected]>" | ||
|
||
RUN yarn global add serve | ||
RUN yarn global add serve@14.1.2 [email protected] | ||
|
||
WORKDIR /app | ||
COPY build/ . | ||
|
||
EXPOSE 3000 | ||
|
||
CMD serve -s . | ||
RUN chmod -R g+w . | ||
|
||
CMD react-inject-env set -d . && serve -s . |
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
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
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
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
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 |
---|---|---|
@@ -1,27 +1,64 @@ | ||
/* eslint-disable no-console */ | ||
import React from 'react'; | ||
import { | ||
BrowserRouter, Routes, Route | ||
} from 'react-router-dom'; | ||
|
||
import './custom.scss'; | ||
|
||
import Layout from './layout/PublicLayout'; | ||
import Home from './views/Home'; | ||
import Landing from './views/Landing'; | ||
import Form from './views/Form'; | ||
import Table from './views/Table'; | ||
import Home from './views/Home'; | ||
import ProtectedRoute from './routes/ProtectedRoute'; | ||
import { useAuth } from './contexts/AuthContext'; | ||
import SilentCheckSso from './components/SilentCheckSso'; | ||
import Logout from './components/Logout'; | ||
|
||
/** | ||
* Create an app structure conaining all the routes. | ||
* | ||
* @returns {JSX.Element} instance of the app ready to use. | ||
*/ | ||
const App: React.FC = () => { | ||
const { signed } = useAuth(); | ||
|
||
function App() { | ||
return ( | ||
<BrowserRouter> | ||
<Routes> | ||
<Route path="/" element={<Layout />}> | ||
<Route path="/" element={<Home />} /> | ||
<Route path="/form" element={<Form />} /> | ||
<Route path="/table" element={<Table />} /> | ||
</Route> | ||
<Route path="/" element={<Landing />} /> | ||
<Route path="/silent-check-sso" element={<SilentCheckSso />} /> | ||
<Route path="/logout" element={<Logout />} /> | ||
|
||
<Route | ||
path="/home" | ||
element={( | ||
<ProtectedRoute signed={signed}> | ||
<Home /> | ||
</ProtectedRoute> | ||
)} | ||
/> | ||
|
||
<Route | ||
path="/form" | ||
element={( | ||
<ProtectedRoute signed={signed}> | ||
<Form /> | ||
</ProtectedRoute> | ||
)} | ||
/> | ||
|
||
<Route | ||
path="/table" | ||
element={( | ||
<ProtectedRoute signed={signed}> | ||
<Table /> | ||
</ProtectedRoute> | ||
)} | ||
/> | ||
</Routes> | ||
</BrowserRouter> | ||
); | ||
} | ||
}; | ||
|
||
export default App; |
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
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
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
Oops, something went wrong.