[FEAT] clenn
This commit is contained in:
parent
332c65360d
commit
c2bad22ae5
183
README.md
183
README.md
@ -1,103 +1,128 @@
|
||||
Karauth
|
||||
=======
|
||||
Karso
|
||||
=====
|
||||
|
||||
This repository manage 3 elements:
|
||||
- The SSO backend: jersey REST server
|
||||
- The SSO front-end: Angular login interface (KARSO)
|
||||
- The adminitrator of the SSO: Angular adminitration interface of the SSO (KARSO)
|
||||
**K**angaroo **A**nd **R**abbit (S)SO is a simple SSO interface that manage multiple application authentication.
|
||||
|
||||
To build the docker image:
|
||||
--------------------------
|
||||
|
||||
Run in local:
|
||||
=============
|
||||
|
||||
Start tools
|
||||
-----------
|
||||
|
||||
Start the server basic interfaces: (DB(mySQL), Adminer)
|
||||
|
||||
```{.bash}
|
||||
gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest
|
||||
# start the Bdd interface (no big data > 50Mo)
|
||||
docker compose -f env_dev/docker-compose.yaml up -d
|
||||
```
|
||||
|
||||
MySql manage multiple users:
|
||||
----------------------------
|
||||
Start the Back-end:
|
||||
-------------------
|
||||
|
||||
It is better to not use root user and mange user for each service.
|
||||
backend is developed in JAVA
|
||||
|
||||
Add a new user
|
||||
```sql
|
||||
CREATE USER 'karso'@'%' IDENTIFIED BY 'base_db_password';
|
||||
GRANT ALL PRIVILEGES ON `karso`.* TO 'karso'@'%';
|
||||
FLUSH PRIVILEGES;
|
||||
The first step is configuring your JAVA version (or select the JVM with the OS)
|
||||
```bash
|
||||
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||
```
|
||||
> **_Note_** the `base_db_password` with the production password. this one is for development environment
|
||||
|
||||
Install the dependency:
|
||||
```bash
|
||||
mvn install
|
||||
```
|
||||
|
||||
To start the service
|
||||
Run the test
|
||||
```bash
|
||||
mvn test
|
||||
```
|
||||
|
||||
Install it for external use
|
||||
```bash
|
||||
mvn install
|
||||
```
|
||||
|
||||
Execute the local server:
|
||||
```bash
|
||||
mvn exec:java@dev-mode
|
||||
```
|
||||
|
||||
Start the Front-end:
|
||||
--------------------
|
||||
|
||||
```{.bash}
|
||||
docker-compose up -d
|
||||
backend is developed in JAVA
|
||||
```bash
|
||||
cd front
|
||||
pnpm install
|
||||
pnpm dev
|
||||
```
|
||||
|
||||
**Note:** you can manage a single Docker interface to manage all the KAR engine
|
||||
Display the result:
|
||||
-------------------
|
||||
|
||||
docker login gitea.atria-soft.org
|
||||
|
||||
docker pull archlinux:base-devel
|
||||
docker pull bellsoft/liberica-openjdk-alpine:latest
|
||||
|
||||
docker build -t gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest .
|
||||
|
||||
docker push gitea.atria-soft.org/kangaroo-and-rabbit/karso:latest
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
npx playwright test
|
||||
Runs the end-to-end tests.
|
||||
|
||||
npx playwright test --project=firefox
|
||||
Runs the tests only on Desktop Chrome.
|
||||
|
||||
npx playwright test example
|
||||
Runs the tests in a specific file.
|
||||
|
||||
npx playwright test --debug
|
||||
Runs the tests in debug mode.
|
||||
|
||||
npx playwright codegen
|
||||
Auto generate tests with Codegen.
|
||||
|
||||
We suggest that you begin by typing:
|
||||
|
||||
npx playwright test
|
||||
|
||||
|
||||
|
||||
Action a faire d'urgence:
|
||||
- Mettre un jenkins en place
|
||||
- dev sur develop et non master
|
||||
- concevoir un système de migration et d'initialisation.
|
||||
- ajouter une interface a sqlWrapper pour supporter sqlite ==> plus facile pour les tests
|
||||
- mettre des test unitaire sur les API REST:
|
||||
- securité des interfaces
|
||||
- viole des token
|
||||
- Fin de validité d'un tocken
|
||||
- Addaque d-DOS
|
||||
- Publier toutes les semaine une version a jour
|
||||
- faire de la documentation pour l'aide
|
||||
- revoir l'interface des paramètre pour la ganérisé
|
||||
- Mettre en place une meilleur page d'acceuil
|
||||
- mettre en config le nom du site
|
||||
- faire un tool qui permet de savoir si le serveur est UP et si ce n'est pas le cas, bloquer l'affichage
|
||||
- mettre en place les coors pour les pages d'administration ==> ca vas ètre coton...
|
||||
- améliorer la gestion et l'affichages des erreur
|
||||
- mettre en place des pop-up de détection d'erreur
|
||||
- mise en place d'envoie d'email pour faire une autentification plus sérieuse.
|
||||
- mettre un place un back-end LDAP
|
||||
[show the webpage: http://localhost:4200](http://localhost:4200)
|
||||
|
||||
|
||||
Some other dev tools:
|
||||
=====================
|
||||
|
||||
Format code:
|
||||
------------
|
||||
|
||||
```bash
|
||||
export PATH=$(ls -d --color=never /usr/lib/jvm/java-2*-openjdk)/bin:$PATH
|
||||
mvn formatter:format
|
||||
mvn test
|
||||
```
|
||||
```
|
||||
|
||||
Tools in production mode
|
||||
========================
|
||||
|
||||
Changing the Log Level
|
||||
----------------------
|
||||
|
||||
In a production environment, you can adjust the log level to help diagnose bugs more effectively.
|
||||
|
||||
The available log levels are:
|
||||
| **Log Level Tag** | **org.kar.karso** | **org.kar.archidata** | **other** |
|
||||
| ----------------- | ------------------- | --------------------- | --------- |
|
||||
| `prod` | INFO | INFO | INFO |
|
||||
| `prod-debug` | DEBUG | INFO | INFO |
|
||||
| `prod-trace` | TRACE | DEBUG | INFO |
|
||||
| `prod-trace-full` | TRACE | TRACE | INFO |
|
||||
| `dev` | TRACE | DEBUG | INFO |
|
||||
|
||||
|
||||
Manual set in production:
|
||||
=========================
|
||||
|
||||
Connect on the registry
|
||||
------------------------
|
||||
|
||||
To log-in and log-out from the registry:
|
||||
```bash
|
||||
export REGISTRY_ADDRESS=gitea.atria-soft.org
|
||||
docker login -u <<YOUR_USER_NAME>> ${REGISTRY_ADDRESS}
|
||||
docker logout ${REGISTRY_ADDRESS}
|
||||
```
|
||||
|
||||
pull the root image of dockers
|
||||
------------------------------
|
||||
|
||||
```bash
|
||||
docker pull archlinux:base-devel
|
||||
docker pull bellsoft/liberica-openjdk-alpine:latest
|
||||
```
|
||||
|
||||
Create the version
|
||||
------------------
|
||||
|
||||
Execute in the local folder: (use ```dev``` for development and ```latest``` for production release)
|
||||
|
||||
```bash
|
||||
export TAG_DOCKER=latest
|
||||
export REGISTRY_ADDRESS=gitea.atria-soft.org
|
||||
docker build -t ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER} .
|
||||
docker push ${REGISTRY_ADDRESS}/kangaroo-and-rabbit/karso:${TAG_DOCKER}
|
||||
```
|
||||
|
||||
|
56
env_dev/docker-compose.yaml
Normal file
56
env_dev/docker-compose.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
services:
|
||||
kar_db_service:
|
||||
image: mysql:latest
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=base_db_password
|
||||
volumes:
|
||||
- ./data:/var/lib/mysql
|
||||
mem_limit: 300m
|
||||
ports:
|
||||
- 3906:3306
|
||||
healthcheck:
|
||||
test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost"]
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
# perform a 1 minute grace to let the DB to perform the initialization
|
||||
start_period: 1m
|
||||
start_interval: 1m
|
||||
|
||||
kar_mongodb_service:
|
||||
image: mongo:latest
|
||||
restart: always
|
||||
environment:
|
||||
MONGO_INITDB_ROOT_USERNAME: root
|
||||
MONGO_INITDB_ROOT_PASSWORD: base_db_password
|
||||
ports:
|
||||
- 27017:27017
|
||||
volumes:
|
||||
- ./dataMongo:/data/db
|
||||
|
||||
kar_adminer_service:
|
||||
image: adminer:latest
|
||||
restart: always
|
||||
depends_on:
|
||||
kar_db_service:
|
||||
condition: service_healthy
|
||||
links:
|
||||
- kar_db_service:db
|
||||
- kar_mongodb_service:dbm
|
||||
ports:
|
||||
- 4079:8080
|
||||
mem_limit: 50m
|
||||
|
||||
mongo_express_service:
|
||||
image: mongo-express
|
||||
restart: always
|
||||
ports:
|
||||
- 4077:8081
|
||||
links:
|
||||
- kar_mongodb_service:db
|
||||
environment:
|
||||
ME_CONFIG_MONGODB_ADMINUSERNAME: root
|
||||
ME_CONFIG_MONGODB_ADMINPASSWORD: base_db_password
|
||||
ME_CONFIG_MONGODB_URL: mongodb://root:base_db_password@db:27017/
|
||||
ME_CONFIG_BASICAUTH: false
|
||||
|
@ -4,23 +4,11 @@ import { Box } from '@chakra-ui/react';
|
||||
import { ChakraProvider } from '@chakra-ui/react';
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
|
||||
import theme from '../src/theme';
|
||||
|
||||
// .storybook/preview.js
|
||||
export const parameters = {
|
||||
options: {
|
||||
storySort: {
|
||||
order: ['StyleGuide', 'Components', 'Fields', 'App Layout'],
|
||||
},
|
||||
},
|
||||
actions: {},
|
||||
layout: 'fullscreen',
|
||||
backgrounds: { disable: true, grid: { disable: true } },
|
||||
chakra: {
|
||||
theme,
|
||||
},
|
||||
};
|
||||
import { ColorModeProvider } from '../src/components/ui/color-mode';
|
||||
import { Toaster } from '../src/components/ui/toaster';
|
||||
import { systemTheme } from '../src/theme/theme';
|
||||
|
||||
// .
|
||||
const DocumentationWrapper = ({ children }) => {
|
||||
return (
|
||||
<Box id="start-ui-storybook-wrapper" p="4" pb="8" flex="1">
|
||||
@ -31,13 +19,16 @@ const DocumentationWrapper = ({ children }) => {
|
||||
|
||||
export const decorators = [
|
||||
(Story, context) => (
|
||||
<ChakraProvider theme={theme}>
|
||||
{/* Using MemoryRouter to avoid route clashing with Storybook */}
|
||||
<MemoryRouter>
|
||||
<DocumentationWrapper>
|
||||
<Story {...context} />
|
||||
</DocumentationWrapper>
|
||||
</MemoryRouter>
|
||||
</ChakraProvider>
|
||||
<ColorModeProvider>
|
||||
<ChakraProvider value={systemTheme}>
|
||||
{/* Using MemoryRouter to avoid route clashing with Storybook */}
|
||||
<MemoryRouter>
|
||||
<DocumentationWrapper>
|
||||
<Story {...context} />
|
||||
</DocumentationWrapper>
|
||||
</MemoryRouter>
|
||||
<Toaster />
|
||||
</ChakraProvider>
|
||||
</ColorModeProvider>
|
||||
),
|
||||
];
|
||||
|
@ -3,11 +3,7 @@ import type { KnipConfig } from 'knip';
|
||||
const config: KnipConfig = {
|
||||
// Ignoring mostly shell binaries
|
||||
ignoreBinaries: ['export', 'sleep'],
|
||||
ignore: [
|
||||
// Related to tests
|
||||
'tests/**',
|
||||
'**.conf.js',
|
||||
],
|
||||
ignore: [],
|
||||
};
|
||||
|
||||
export default config;
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { ReactNode, useEffect } from 'react';
|
||||
import { ReactNode, useEffect } from 'react';
|
||||
|
||||
import { Flex, FlexProps } from '@chakra-ui/react';
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
@ -113,18 +113,6 @@ export const TopBar = ({ title, children }: TopBarProps) => {
|
||||
drawerDisclose.onOpen();
|
||||
};
|
||||
const navigate = useNavigate();
|
||||
// const onSignIn = (): void => {
|
||||
// clearToken();
|
||||
// requestSignIn();
|
||||
// };
|
||||
// const onSignUp = (): void => {
|
||||
// clearToken();
|
||||
// requestSignUp();
|
||||
// };
|
||||
// const onSignOut = (): void => {
|
||||
// clearToken();
|
||||
// requestSignOut();
|
||||
// };
|
||||
return (
|
||||
<Flex
|
||||
position="absolute"
|
||||
@ -189,7 +177,6 @@ export const TopBar = ({ title, children }: TopBarProps) => {
|
||||
<MenuRoot>
|
||||
<MenuTrigger asChild>
|
||||
<IconButton
|
||||
//asChild
|
||||
{...BUTTON_TOP_BAR_PROPERTY}
|
||||
width={TOP_BAR_HEIGHT}
|
||||
>
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ReactNode, useState } from 'react';
|
||||
import { ReactNode } from 'react';
|
||||
|
||||
import { LuMenu } from 'react-icons/lu';
|
||||
|
||||
|
@ -1,14 +1,6 @@
|
||||
import { RefObject, useEffect, useMemo, useRef, useState } from 'react';
|
||||
|
||||
import {
|
||||
Button,
|
||||
Flex,
|
||||
HStack,
|
||||
Input,
|
||||
Spinner,
|
||||
Tag,
|
||||
TagLabel,
|
||||
} from '@chakra-ui/react';
|
||||
import { Button, Flex, HStack, Input, Spinner, Tag } from '@chakra-ui/react';
|
||||
import { MdEdit, MdKeyboardArrowDown, MdKeyboardArrowUp } from 'react-icons/md';
|
||||
|
||||
import { SelectList, SelectListModel } from '@/components/select/SelectList';
|
||||
|
@ -9,7 +9,7 @@ export interface Environment {
|
||||
replaceDataToRealServer?: boolean;
|
||||
}
|
||||
|
||||
const serverSSOAddress = 'http://atria-soft.org';
|
||||
const serverSSOAddress = 'https://atria-soft.org';
|
||||
|
||||
const environment_back_prod: Environment = {
|
||||
production: false,
|
||||
|
@ -31,5 +31,9 @@ const ErrorFallback = ({ error }: FallbackProps) => {
|
||||
};
|
||||
|
||||
export const ErrorBoundary = ({ children }: { children: ReactNode }) => {
|
||||
return <ReactErrorBoundary FallbackComponent={ErrorFallback} {...props} />;
|
||||
return (
|
||||
<ReactErrorBoundary FallbackComponent={ErrorFallback}>
|
||||
{children}
|
||||
</ReactErrorBoundary>
|
||||
);
|
||||
};
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { createBrowserHistory } from 'history';
|
||||
import {
|
||||
unstable_HistoryRouter as HistoryRouter,
|
||||
Navigate,
|
||||
Route,
|
||||
Routes,
|
||||
} from 'react-router-dom';
|
||||
@ -27,7 +28,8 @@ export const AppRoutes = () => {
|
||||
<Routes>
|
||||
{isReadable ? (
|
||||
<>
|
||||
<Route path="/" element={<HomePage />} />
|
||||
<Route path="/" element={<Navigate to="home" replace />} />
|
||||
<Route path="/home/*" element={<HomePage />} />
|
||||
{/* Connection page after SSO */}
|
||||
<Route
|
||||
path="signin/:applicationName/:applicationData/*"
|
||||
|
Loading…
x
Reference in New Issue
Block a user